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://pohmelie.github.io/aioftp or http://aioftp.readthedocs.org (no python 3.5))

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.5

  • docopt (for execution module as script only)

License

aioftp is offered under the WTFPL license.

Library Installation

pip install aioftp

Getting started

Client example

import asyncio
import aioftp


async def get_mp3(host, login, password):

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

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

            await client.download(path)

    await client.quit()


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.4.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

aioftp-0.4.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aioftp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e4fd8a1347d4676b031e8b1a22c6f3490bb27bf4a3c4b0d775546cd3a9f96753
MD5 82d10ffc65dc1f3bfc4d21f426850a7a
BLAKE2b-256 acb875e03cb0cc38ab91de4f665764fd52ed6363609880c5f12b604dca2986d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aioftp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9036b5ba95dcc6b19870eb8883c1b4f87517a3cc9fa2e9751043adf72ac416f
MD5 3f5e2694ef07a394375ac47575faef01
BLAKE2b-256 0473cbf21cf1f398404db8b1b67d106b51816b6fc0405c5e42c86db235eaf339

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