ftp client/server for asyncio
Project description
ftp client/server for asyncio. (http://aioftp.readthedocs.org)
Features
Simple.
Extensible.
Proxy via twunnel3.
Dependencies
Python 3.4+
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):
ftp = aioftp.Client()
yield from ftp.connect(host)
yield from ftp.login(login, password)
for path, info in (yield from ftp.list(recursive=True)):
if info["type"] == "file" and path.suffix == ".mp3":
yield from ftp.download(path, path.name)
loop = asyncio.get_event_loop()
tasks = (
asyncio.async(get_mp3("server1.com", "login", "password")),
asyncio.async(get_mp3("server2.com", "login", "password")),
asyncio.async(get_mp3("server3.com", "login", "password")),
)
loop.run_until_complete(asyncio.wait(tasks))
loop.close()
Server example
import aioftp
import asyncio
loop = asyncio.get_event_loop()
ftp = aioftp.Server()
asyncio.async(ftp.start(None, 8021))
try:
loop.run_forever()
except KeyboardInterrupt:
ftp.close()
loop.run_until_complete(ftp.wait_closed())
loop.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
aioftp-0.1.0-py3-none-any.whl
(17.1 kB
view details)
File details
Details for the file aioftp-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aioftp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 756086ec708c014a8c079cf4d6509d4759c5c7c70f895189554736920a2a9342 |
|
MD5 | c3bbb69c656eff1cf72fed6dfd169f2a |
|
BLAKE2b-256 | 9a07e1a3390ee1bf1b609b357fa8f5a96f3ff9f82c3541d00e6568b2dd0b0f6c |