Skip to main content

HTTP resources as random-access file-like objects

Project description

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:

$ pip install httpio

Usage

import zipfile
import httpio

url = "http://some/large/file.zip"
with httpio.open(url) as fp:
    zf = zipfile.ZipFile(fp)
    print(zf.namelist())

Unit Tests

Unit tests are provided for the standard behaviours implemented by the library. They can be run with

$ 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:

$ tox

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

httpio-0.3.0.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file httpio-0.3.0.tar.gz.

File metadata

  • Download URL: httpio-0.3.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for httpio-0.3.0.tar.gz
Algorithm Hash digest
SHA256 38dafc07874b5033499af9f1465e2b31f93e6934c52effa76d43695a98af1ae8
MD5 9891b99c86ecd3f1c7c29a669f774ee9
BLAKE2b-256 b20104e1fe7470139d5fe39be055c0defde4b80ef42878cee4706664046d87d1

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