Giter Site home page Giter Site logo

hip's Introduction

Hip

Build status on Travis Build status on GitHub Actions Coverage Status PyPI version Gitter

Hip is a new Python HTTP client for everybody. It supports synchronous Python (just like requests does), but also Trio, asyncio and Curio.

Important

Hip is still in its early days, use at your own risk! In particular, the async support is still experimental and untested.

Hip is robust as it is based on urllib3 and uses its extensive test suite that was refined over the years. It also shares most urllib3 features:

  • Thread safety.
  • Connection pooling.
  • Client-side SSL/TLS verification.
  • File uploads with multipart encoding.
  • Helpers for retrying requests and dealing with HTTP redirects.
  • Support for gzip, deflate, and brotli encoding.
  • Proxy support for HTTP.
  • 100% test coverage.

However, we currently do not support SOCKS proxies nor the pyOpenSSL and SecureTransport TLS backends.

Sample code

Hip is powerful and easy to use:

>>> import hip
>>> http = hip.PoolManager()
>>> r = http.request('GET', 'http://httpbin.org/robots.txt')
>>> r.status
200
>>> r.data
'User-agent: *\nDisallow: /deny\n'

It also supports async/await:

import ahip
import trio

async def main():
    with ahip.PoolManager() as http:
        r = await http.request("GET", "http://httpbin.org/uuid")
        print("Status:", r.status)  # 200
        print("Data:", r.data) # 'User-agent: *\nDisallow: /deny\n'

trio.run(main)

Installing

Hip can be installed with pip:

$ python -m pip install hip

Alternatively, you can grab the latest source code from GitHub:

$ python -m pip install git+https://github.com/python-trio/hip

- OR -

$ git clone git://github.com/python-trio/hip.git
$ cd hip && python setup.py install

Documentation

Hip will soon have usage and reference documentation at hip.readthedocs.io.

Contributing

Hip happily accepts contributions. Please see our contributing documentation for some tips on getting started.

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.