Skip to content
Myr

index.md

This file

Path

docs/index.md

146 lines · 4.2 KiB · Markdown

Last changed by

Drop StreamContextManager in favour of `contextlib.contextmanager`/`asynccontextmanager` (#1577)Tom Christiebefore adoption8fd5b71

History of this file

Take it

The walk stopped after 200 commits: lines older than 2d491c9 point at it.

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

line 1why, one step back
1<p align="center" style="margin: 0 0 10px">

Update butterfly logo (#1382)Tom Christiebefore adoptionceccb96

line 2why, one step back
2 <img width="350" height="208" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/butterfly.png" alt='HTTPX'>

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 3–29why, one step back
3</p>
45<h1 align="center" style="font-size: 3rem; margin: -15px 0">6HTTPX7</h1>89---1011<div align="center">12<p>13<a href="https://github.com/encode/httpx/actions">14 <img src="https://github.com/encode/httpx/workflows/Test%20Suite/badge.svg" alt="Test Suite">15</a>16<a href="https://pypi.org/project/httpx/">17 <img src="https://badge.fury.io/py/httpx.svg" alt="Package version">18</a>19</p>2021<em>A next-generation HTTP client for Python.</em>22</div>2324HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.252627!!! note28 HTTPX should currently be considered in beta.29

Version 0.17.0 (#1403)Tom Christiebefore adoption59f65e2

line 30why, one step back
30 We believe we've got the public API to a stable point now, but would strongly recommend pinning your dependencies to the `0.17.*` release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md).

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

line 31why, one step back
31

Update README to reflect new estimate for v1.0 release (#1445)nkitsainibefore adoption1816393

line 32why, one step back
32 A 1.0 release is expected to be issued sometime in 2021.

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 33–37why, one step back
33
34---3536Let's get started...37

Use pycon for Python console code blocks (#1187)Hugo van Kemenadebefore adoptiond10b7cd

line 38why, one step back
38```pycon

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 39–54why, one step back
39>>> import httpx
40>>> r = httpx.get('https://www.example.org/')41>>> r42<Response [200 OK]>43>>> r.status_code4420045>>> r.headers['content-type']46'text/html; charset=UTF-8'47>>> r.text48'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'49```5051Or, using the async API...5253_Use [IPython](https://ipython.readthedocs.io/en/stable/) or Python 3.8+ with `python -m asyncio` to try this code interactively._54

Use pycon for Python console code blocks (#1187)Hugo van Kemenadebefore adoptiond10b7cd

line 55why, one step back
55```pycon

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 56–57why, one step back
56>>> import httpx
57>>> async with httpx.AsyncClient() as client:

Fix typo (#1386)Kyungmin Leebefore adoption84dca25

lines 58–59why, one step back
58... r = await client.get('https://www.example.org/')
59...

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 60–74why, one step back
60>>> r
61<Response [200 OK]>62```6364## Features6566HTTPX is a high performance asynchronous HTTP client, that builds on the67well-established usability of `requests`, and gives you:6869* A broadly [requests-compatible API](compatibility.md).70* Standard synchronous interface, but with [async support if you need it](async.md).71* HTTP/1.1 [and HTTP/2 support](http2.md).72* Ability to make requests directly to [WSGI applications](advanced.md#calling-into-python-web-apps) or [ASGI applications](async.md#calling-into-python-web-apps).73* Strict timeouts everywhere.74* Fully type annotated.

Update README.md (#1291)Tom Christiebefore adoptionff0febb

line 75why, one step back
75* 100% test coverage.

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 76–103why, one step back
76
77Plus all the standard features of `requests`...7879* International Domains and URLs80* Keep-Alive & Connection Pooling81* Sessions with Cookie Persistence82* Browser-style SSL Verification83* Basic/Digest Authentication84* Elegant Key/Value Cookies85* Automatic Decompression86* Automatic Content Decoding87* Unicode Response Bodies88* Multipart File Uploads89* HTTP(S) Proxy Support90* Connection Timeouts91* Streaming Downloads92* .netrc Support93* Chunked Requests9495## Documentation9697For a run-through of all the basics, head over to the [QuickStart](quickstart.md).9899For more advanced topics, see the [Advanced Usage](advanced.md) section,100the [async support](async.md) section, or the [HTTP/2](http2.md) section.101102The [Developer Interface](api.md) provides a comprehensive API reference.103

Refine project workflow (#1534)Tom Christiebefore adoption437b55c

line 104why, one step back
104To find out about tools that integrate with HTTPX, see [Third Party Packages](third_party_packages.md).

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 105–111why, one step back
105
106## Dependencies107108The HTTPX project relies on these excellent libraries:109110* `httpcore` - The underlying transport implementation for `httpx`.111 * `h11` - HTTP/1.1 support.

Packaging dependancy tweaks (#1206)Joebefore adoption15c1e42

line 112why, one step back
112 * `h2` - HTTP/2 support. *(Optional)*

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 113–114why, one step back
113* `certifi` - SSL certificates.
114* `rfc3986` - URL parsing & normalization.

Packaging dependancy tweaks (#1206)Joebefore adoption15c1e42

line 115why, one step back
115 * `idna` - Internationalized domain name support.

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

line 116why, one step back
116* `sniffio` - Async library autodetection.

Drop StreamContextManager in favour of `contextlib.contextmanager`/`asynccontextmanager` (#1577)Tom Christiebefore adoption8fd5b71

line 117why, one step back
117* `async_generator` - Backport support for `contextlib.asynccontextmanager`. *(Only required for Python 3.6)*

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 118–131why, one step back
118* `brotlipy` - Decoding for "brotli" compressed responses. *(Optional)*
119120A huge amount of credit is due to `requests` for the API layout that121much of this work follows, as well as to `urllib3` for plenty of design122inspiration around the lower-level networking details.123124## Installation125126Install with pip:127128```shell129$ pip install httpx130```131

HTTP/2 becomes fully optional (#1140)Tom Christiebefore adoption8d9dfb5

lines 132–135why, one step back
132Or, to include the optional HTTP/2 support, use:
133134```shell135$ pip install httpx[http2]

Packaging dependancy tweaks (#1206)Joebefore adoption15c1e42

lines 136–141why, one step back
136```
137138To include the optional brotli decoder support, use:139140```shell141$ pip install httpx[brotli]

HTTP/2 becomes fully optional (#1140)Tom Christiebefore adoption8d9dfb5

lines 142–143why, one step back
142```
143

Full coverage, with exception of URLLib3Transport (#1086)Tom Christiebefore adoption2d491c9

lines 144–146why, one step back
144HTTPX requires Python 3.6+
145146[sync-support]: https://github.com/encode/httpx/issues/572