Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

httpio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpio

HTTP resources as random-access file-like objects

  • 0.3.0
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc