Metadata-Version: 1.2
Name: aioftp
Version: 0.1.0
Summary: ftp client/server for asyncio
Home-page: https://github.com/pohmelie/aioftp
License: UNKNOWN
Author: pohmelie
Author-email: multisosnooley@gmail.com
Requires-Python: >=3.4
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Internet :: File Transfer Protocol (FTP)

.. aioftp documentation master file, created by
   sphinx-quickstart on Fri Apr 17 16:21:03 2015.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

aioftp
======

.. image:: https://travis-ci.org/pohmelie/aioftp.svg?branch=master
    :target: https://travis-ci.org/pohmelie/aioftp

.. image:: https://coveralls.io/repos/pohmelie/aioftp/badge.svg?branch=master
    :target: https://coveralls.io/r/pohmelie/aioftp?branch=master

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

.. _GitHub: https://github.com/pohmelie/aioftp

Features
--------

- Simple.
- Extensible.
- Proxy via `twunnel3 <https://github.com/jvansteirteghem/twunnel3>`_.

Dependencies
------------

- Python 3.4+

License
-------

aioftp is offered under the Apache 2 license.

Library Installation
--------------------

::

   pip install aioftp

Getting started
---------------

Client example

.. code-block:: python

    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

.. code-block:: python

    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()

