requests-ftp


Namerequests-ftp JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttp://github.com/Lukasa/requests-ftp
SummaryFTP Transport Adapter for Requests.
upload_time2015-08-13 21:02:08
maintainerNone
docs_urlNone
authorCory Benfield
requires_pythonNone
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements requests wsgiref
Travis-CI
coveralls test coverage No coveralls.
            Requests-FTP
============

Requests-FTP is an implementation of a very stupid FTP transport adapter for
use with the awesome `Requests`_ Python library.

This library is *not* intended to be an example of Transport Adapters best
practices. This library was cowboyed together in about 4 hours of total work,
has no tests, and relies on a few ugly hacks. Instead, it is intended as both
a starting point for future development and a useful example for how to
implement transport adapters.

Here's how you use it:

.. code-block:: pycon

    >>> import requests
    >>> import requests_ftp
    >>> requests_ftp.monkeypatch_session()
    >>> s = requests.Session()
    >>> resp = s.list('ftp://127.0.0.1/', auth=('Lukasa', 'notmypass'))
    >>> resp.status_code
    '226'
    >>> print resp.content
    ...snip...
    >>> resp = s.stor('ftp://127.0.0.1/test.txt', auth=('Lukasa', 'notmypass'),
                       files={'file': open('report.txt', 'rb')})


Features
--------

Almost none!

- Adds the FTP LIST, STOR, RETR and NLST verbs via a new FTP transport adapter.
- Provides a function that monkeypatches the Requests Session object, exposing
  helper methods much like the current ``Session.get()`` and ``Session.post()``
  methods.
- Piggybacks on standard Requests idioms: uses normal Requests models and
  access methods, including the tuple form of authentication.

Does not provide:

- Connection pooling! One new connection and multiple commands for each
  request, including authentication. **Super** inefficient.
- SFTP. Security is for the weak.
- Less common commands.

Important Notes
---------------

Many corners have been cut in my rush to get this code finished. The most
obvious problem is that this code does not have *any* tests. This is my highest
priority for fixing.

More notably, we have the following important caveats:

- The design of the Requests Transport Adapater means that the STOR method
  has to un-encode a multipart form-data encoded body to get the file. This is
  painful, and I haven't tested this thoroughly, so it might not work.
- **Massive** assumptions have been made in the use of the STOR method. This
  code assumes that there will only be one file included in the files argument.
  It also requires that you provide the filename to save as as part of the URL.
  This is single-handedly the most brittle part of this adapter.
- This code is not optimised for performance AT ALL. There is some low-hanging
  fruit here: we should be able to connection pool relatively easily, and we
  can probably avoid making some of the requests we do.

Contributing
------------

Please do! I would love for this to be developed further by anyone who is
interested. Wherever possible, please provide unit tests for your work (yes,
this is very much a 'do as I say, not as I do' kind of moment). Don't forget
to add your name to AUTHORS.

License
-------

To maximise compatibility with Requests, this code is licensed under the Apache
license. See LICENSE for more details.

.. _`Requests`: https://github.com/kennethreitz/requests
            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/Lukasa/requests-ftp",
    "name": "requests-ftp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Cory Benfield",
    "author_email": "cory@lukasa.co.uk",
    "download_url": "https://files.pythonhosted.org/packages/3d/ca/14b2ad1e93b5195eeaf56b86b7ecfd5ea2d5754a68d17aeb1e5b9f95b3cf/requests-ftp-0.3.1.tar.gz",
    "platform": "UNKNOWN",
    "description": "Requests-FTP\n============\n\nRequests-FTP is an implementation of a very stupid FTP transport adapter for\nuse with the awesome `Requests`_ Python library.\n\nThis library is *not* intended to be an example of Transport Adapters best\npractices. This library was cowboyed together in about 4 hours of total work,\nhas no tests, and relies on a few ugly hacks. Instead, it is intended as both\na starting point for future development and a useful example for how to\nimplement transport adapters.\n\nHere's how you use it:\n\n.. code-block:: pycon\n\n    >>> import requests\n    >>> import requests_ftp\n    >>> requests_ftp.monkeypatch_session()\n    >>> s = requests.Session()\n    >>> resp = s.list('ftp://127.0.0.1/', auth=('Lukasa', 'notmypass'))\n    >>> resp.status_code\n    '226'\n    >>> print resp.content\n    ...snip...\n    >>> resp = s.stor('ftp://127.0.0.1/test.txt', auth=('Lukasa', 'notmypass'),\n                       files={'file': open('report.txt', 'rb')})\n\n\nFeatures\n--------\n\nAlmost none!\n\n- Adds the FTP LIST, STOR, RETR and NLST verbs via a new FTP transport adapter.\n- Provides a function that monkeypatches the Requests Session object, exposing\n  helper methods much like the current ``Session.get()`` and ``Session.post()``\n  methods.\n- Piggybacks on standard Requests idioms: uses normal Requests models and\n  access methods, including the tuple form of authentication.\n\nDoes not provide:\n\n- Connection pooling! One new connection and multiple commands for each\n  request, including authentication. **Super** inefficient.\n- SFTP. Security is for the weak.\n- Less common commands.\n\nImportant Notes\n---------------\n\nMany corners have been cut in my rush to get this code finished. The most\nobvious problem is that this code does not have *any* tests. This is my highest\npriority for fixing.\n\nMore notably, we have the following important caveats:\n\n- The design of the Requests Transport Adapater means that the STOR method\n  has to un-encode a multipart form-data encoded body to get the file. This is\n  painful, and I haven't tested this thoroughly, so it might not work.\n- **Massive** assumptions have been made in the use of the STOR method. This\n  code assumes that there will only be one file included in the files argument.\n  It also requires that you provide the filename to save as as part of the URL.\n  This is single-handedly the most brittle part of this adapter.\n- This code is not optimised for performance AT ALL. There is some low-hanging\n  fruit here: we should be able to connection pool relatively easily, and we\n  can probably avoid making some of the requests we do.\n\nContributing\n------------\n\nPlease do! I would love for this to be developed further by anyone who is\ninterested. Wherever possible, please provide unit tests for your work (yes,\nthis is very much a 'do as I say, not as I do' kind of moment). Don't forget\nto add your name to AUTHORS.\n\nLicense\n-------\n\nTo maximise compatibility with Requests, this code is licensed under the Apache\nlicense. See LICENSE for more details.\n\n.. _`Requests`: https://github.com/kennethreitz/requests",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "FTP Transport Adapter for Requests.",
    "version": "0.3.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "1a52ad1219e696b5abd5449d1ccc0294",
                "sha256": "7504ceb5cba8a5c0135ed738596820a78c5f2be92d79b29f96ba99b183d8057a"
            },
            "downloads": -1,
            "filename": "requests-ftp-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1a52ad1219e696b5abd5449d1ccc0294",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7850,
            "upload_time": "2015-08-13T21:02:08",
            "upload_time_iso_8601": "2015-08-13T21:02:08.294466Z",
            "url": "https://files.pythonhosted.org/packages/3d/ca/14b2ad1e93b5195eeaf56b86b7ecfd5ea2d5754a68d17aeb1e5b9f95b3cf/requests-ftp-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2015-08-13 21:02:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Lukasa",
    "github_project": "requests-ftp",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.3.0"
                ]
            ]
        },
        {
            "name": "wsgiref",
            "specs": []
        }
    ],
    "test_requirements": [
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "2.8.7"
                ]
            ]
        },
        {
            "name": "pytest-xdist",
            "specs": [
                [
                    "==",
                    "1.13.1"
                ]
            ]
        },
        {
            "name": "pyftpdlib",
            "specs": [
                [
                    "==",
                    "1.5.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.10.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "requests-ftp"
}
        
Elapsed time: 0.05322s