HTTPX 1.0 — Prelease.
A complete HTTP toolkit for Python. Supporting both client & server, and available in either sync or async flavors.
Installation...
$ pip install --pre httpx
Making requests as a client...
>>> r = httpx.get('https://www.example.org/')
>>> r
<Response [200 OK]>
>>> r.status_code
200
>>> r.headers['content-type']
'text/html; charset=UTF-8'
>>> r.text()
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
Serving responses as the server...
>>> def hello_world(request):
... content = httpx.HTML('<html><body>hello, world.</body></html>')
... return httpx.Response(200, content=content)
>>> with httpx.serve_http(hello_world) as server:
... print(f"Serving on {server.url} (Press CTRL+C to quit)")
... server.wait()
Serving on http://127.0.0.1:8080/ (Press CTRL+C to quit)
Documentation
- Quickstart
- Clients
- Servers
- Requests
- Responses
- URLs
- Headers
- Content Types
- Connections
- Network Backends
Collaboration
The repository for this project is currently private.
We’re looking at creating paid opportunities for working on open source software which are properly compensated, flexible & well balanced.
If you're interested in a position working on this project, please send an intro: kim@encode.io
This design work is not yet licensed for reuse.
— 🦋 —