Skip to main content

ftp client/server for asyncio

Project description

https://img.shields.io/travis/pohmelie/aioftp.svg https://img.shields.io/coveralls/pohmelie/aioftp.svg https://img.shields.io/pypi/v/aioftp.svg https://img.shields.io/pypi/pyversions/aioftp.svg

ftp client/server for asyncio. (http://aioftp.readthedocs.org)

Features

  • Simple.

  • Extensible.

  • Proxy via twunnel3.

Goals

  • Minimum usable core.

  • Do not use deprecated or overridden commands and features (if possible).

  • Very high level api.

Client use this commands: USER, PASS, ACCT, PWD, CWD, CDUP, MKD, RMD, MLSD, MLST, RNFR, RNTO, DELE, STOR, APPE, RETR, TYPE, PASV, ABOR, QUIT

Server support this commands: USER, PASS, QUIT, PWD, CWD, CDUP, MKD, RMD, MLSD, LIST (but it’s not recommended to use it, cause it has no standard format), MLST, RNFR, RNTO, DELE, STOR, RETR, TYPE (only “I”), PASV, ABOR, APPE

This subsets are enough for 99% of tasks, but if you need something, then you can easily extend current set of commands.

Dependencies

  • Python 3.4.2+

  • docopt (for execution module as script only)

License

aioftp is offered under the Apache 2 license.

Library Installation

pip install aioftp

Getting started

Client example

import asyncio
import aioftp


@asyncio.coroutine
def get_mp3(host, login, password):

    client = aioftp.Client()
    yield from client.connect(host)
    yield from client.login(login, password)
    for path, info in (yield from client.list(recursive=True)):

        if info["type"] == "file" and path.suffix == ".mp3":

            yield from client.download(path)


loop = asyncio.get_event_loop()
tasks = (
    get_mp3("server1.com", "login", "password")),
    get_mp3("server2.com", "login", "password")),
    get_mp3("server3.com", "login", "password")),
)
loop.run_until_complete(asyncio.wait(tasks))
loop.close()

Server example

import asyncio
import aioftp


loop = asyncio.get_event_loop()
server = aioftp.Server()
loop.run_until_complete(server.start(None, 8021))
try:

    loop.run_forever()

except KeyboardInterrupt:

    server.close()
    loop.run_until_complete(server.wait_closed())
    loop.close()

Or just use simple server

python -m aioftp --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioftp-0.3.1.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

aioftp-0.3.1-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file aioftp-0.3.1.tar.gz.

File metadata

  • Download URL: aioftp-0.3.1.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aioftp-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0c96684fdebb4410830fc09d59bcec6df601975ebb777fd9c4161ef7c84e6a0c
MD5 97441234fd66e5200a1bdde661a35b57
BLAKE2b-256 68e3e37ae7c7cde99ae78c00c7897aef3c699d644315072714b88d5101c977d5

See more details on using hashes here.

File details

Details for the file aioftp-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aioftp-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06caed2c2f7bfc7b824a7e27646e1c668c3b4475b318f87cfe8d3c8b4ab5c4a3
MD5 a0fae219c39ae6f2359184a51f0693ef
BLAKE2b-256 5f7a54320337c6570ae7620d87a543dc388282f85e76510004c71a789f195e9a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page