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.
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)
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
Hip will soon have usage and reference documentation at hip.readthedocs.io.
Hip happily accepts contributions. Please see our contributing documentation for some tips on getting started.