Skip to main content

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:

$ 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

Metadata

Release files for httpio 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpio 0.3.0
File Size Uploaded
httpio-0.3.0.tar.gz 6.3 kB Details

Release files / httpio-0.3.0.tar.gz

Download URL httpio-0.3.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
38dafc07874b5033499af9f1465e2b31f93e6934c52effa76d43695a98af1ae8
BLAKE2b-256 checksum
How to use checksums
b20104e1fe7470139d5fe39be055c0defde4b80ef42878cee4706664046d87d1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page