GithubHelp home page GithubHelp logo

samdbmg / httpio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from barneygale/httpio

0.0 1.0 0.0 40 KB

Python library for reading HTTP resources as random-access file-like objects using the `Range` header

License: Other

Python 100.00%

httpio's Introduction

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

httpio's People

Contributors

barneygale avatar jamesba avatar z4ce avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.