GithubHelp home page GithubHelp logo

dedayoa / pyftp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geekpradd/pyftp

0.0 1.0 0.0 136 KB

A Better abstraction layer over Python's default ftplib module for FTP Access.

License: MIT License

Python 100.00%

pyftp's Introduction

##PyFTP

PyFTP is a better FTP module for Python that builds on top of the default ftplib module. It aims to provide better access to the methods given in ftplib and reduce code repetitiveness.

This module is under development.

###Why build it?

Python's default ftplib module, altough fairly powerful, isn't intuitive and simple to use at all. Most of the default methods require using FTP commands as parameters and a lot more.

For Example, to upload a file in ftplib, you need to use the following code:

from ftplib import FTP

ftp = FTP(host='127.0.0.1')
ftp.login()
ftp.storbinary("STOR newname.jpg" , open('img.jpg','rb'))

Wait, what is STOR above? Can't Python write that out itself. There is a reason behind that, that is that We can supply another command in place of STOR above. Nice, but most of the time we will be using STOR itself. So there is no need for different commands. In the end, whenever we want to upload files, we will have to write more code.

That is where PyFTP fits in. The repetitiveness is handled by the module itself and you have simpler methods to work with.

In PyFTP, the above code becomes:

from ftp import ftp 

con = ftp(host='127.0.0.1') #You are automatically logged in
con.writefile('img.jpg', newname='newname.jpg')

See, the entire usage pattern becomes much simpler. Similarly, PyFTP provides different and easier methods for working with ftplib.

Infact, my vision for PyFTP is somewhat like what requests is to urllib. requests is far more easier and better for accessing HTTP resources thatn urllib and PyFTP should become something like that too.

###Inheriting from FTP

In case, any API is not available in PyFTP, you can use the good old ftplib commands with PyFTP too. Because, the ftp class of PyFTP inherits from the FTP class of ftplib.

###About

PyFTP is under development. PyFTP will be extensively used in my upcoming program, Zoe which provides FTP access to git.

Created By Pradipta. Copyright 2015. MIT Licensed.

pyftp's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.