httpio
======
HTTP resources as random-access file-like objects
httpio is a small Python library that allows you to access files
served over HTTP as file-like_ objects (which is to say that they
support the interface of the standard library's BufferedIOBase_
class). It differs from libraries like ``urllib`` and ``requests`` in
that it supports ``seek()`` (which moves an internal pointer), and
that ``read()`` makes a request with the ``Range`` header set. It also
supports caching of contents using a configurable block size, and will
reuse TCP connections where possible.
Installation
------------
Use ``pip`` to install httpio:
.. code-block:: console
$ pip install httpio
Usage
-----
.. code-block:: python
import zipfile
import httpio
url = "http://some/large/file.zip"
with httpio.open(url) as fp:
zf = zipfile.ZipFile(fp)
print(zf.namelist())
.. _file-like: https://docs.python.org/3/glossary.html#term-file-object
.. _BufferedIOBase: https://docs.python.org/3/library/io.html#io.BufferedIOBase
Unit Tests
----------
Unit tests are provided for the standard behaviours implemented by
the library. They can be run with
.. code-block:: console
$ python -m unittest discover -s tests
or a ``tox.ini`` file is provided which allows the tests to be run in
virtual environments using the ``tox`` tool:
.. code-block:: console
$ tox
Raw data
{
"_id": null,
"home_page": "https://github.com/barneygale/httpio",
"name": "httpio",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Barney Gale",
"author_email": "barney@barneygale.co.uk",
"download_url": "https://files.pythonhosted.org/packages/b2/01/04e1fe7470139d5fe39be055c0defde4b80ef42878cee4706664046d87d1/httpio-0.3.0.tar.gz",
"platform": "",
"description": "httpio\n======\n\nHTTP resources as random-access file-like objects\n\nhttpio is a small Python library that allows you to access files\nserved over HTTP as file-like_ objects (which is to say that they\nsupport the interface of the standard library's BufferedIOBase_\nclass). It differs from libraries like ``urllib`` and ``requests`` in\nthat it supports ``seek()`` (which moves an internal pointer), and\nthat ``read()`` makes a request with the ``Range`` header set. It also\nsupports caching of contents using a configurable block size, and will\nreuse TCP connections where possible.\n\nInstallation\n------------\n\nUse ``pip`` to install httpio:\n\n.. code-block:: console\n\n $ pip install httpio\n\nUsage\n-----\n\n.. code-block:: python\n\n import zipfile\n import httpio\n\n url = \"http://some/large/file.zip\"\n with httpio.open(url) as fp:\n zf = zipfile.ZipFile(fp)\n print(zf.namelist())\n\n.. _file-like: https://docs.python.org/3/glossary.html#term-file-object\n\n.. _BufferedIOBase: https://docs.python.org/3/library/io.html#io.BufferedIOBase\n\nUnit Tests\n----------\n\nUnit tests are provided for the standard behaviours implemented by\nthe library. They can be run with\n\n.. code-block:: console\n \n $ python -m unittest discover -s tests\n\nor a ``tox.ini`` file is provided which allows the tests to be run in\nvirtual environments using the ``tox`` tool:\n\n.. code-block:: console\n \n $ tox",
"bugtrack_url": null,
"license": "MIT",
"summary": "HTTP resources as random-access file-like objects",
"version": "0.3.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9891b99c86ecd3f1c7c29a669f774ee9",
"sha256": "38dafc07874b5033499af9f1465e2b31f93e6934c52effa76d43695a98af1ae8"
},
"downloads": -1,
"filename": "httpio-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "9891b99c86ecd3f1c7c29a669f774ee9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6347,
"upload_time": "2019-06-14T03:15:32",
"upload_time_iso_8601": "2019-06-14T03:15:32.613681Z",
"url": "https://files.pythonhosted.org/packages/b2/01/04e1fe7470139d5fe39be055c0defde4b80ef42878cee4706664046d87d1/httpio-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-06-14 03:15:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "barneygale",
"github_project": "httpio",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "httpio"
}