Skip to content
Myr

index.md

This file

Path

docs/index.md

154 lines · 4.5 KiB · Markdown

Last changed by

Tidy up the formatting of HTTP/2 requests (#1860)Tom Christiebefore adoptione1abaf1

History of this file

Take it

The walk stopped after 200 commits: lines older than 8fa8765 point at it.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

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'>

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 3–27why, 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!!! note

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 28why, one step back
28 This is the documentation for the 1.0 pre-release.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

line 29why, one step back
29

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 30why, one step back
30 This release adds support for an integrated command-line client, and also includes a couple of design changes from 0.19. Redirects are no longer followed by default, and the low-level Transport API has been updated. See [the CHANGELOG](https://github.com/encode/httpx/blob/version-1.0/CHANGELOG.md) for more details.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 31–33why, one step back
31
32---33

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 34why, one step back
34Installing the HTTPX 1.0 pre-release.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

line 35why, one step back
35

Add cli support (#1855)Tom Christiebefore adoptionee9250d

lines 36–41why, one step back
36```shell
37$ pip install httpx --pre38```3940Now, let's get started...41

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 42–54why, one step back
42```pycon
43>>> import httpx44>>> r = httpx.get('https://www.example.org/')45>>> r46<Response [200 OK]>47>>> r.status_code4820049>>> r.headers['content-type']50'text/html; charset=UTF-8'51>>> r.text52'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'53```54

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 55why, one step back
55Or, using the command-line client.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

line 56why, one step back
56

Add cli support (#1855)Tom Christiebefore adoptionee9250d

lines 57–59why, one step back
57```shell
58# The command line client is an optional dependency.59$ pip install --pre 'httpx[cli]'

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 60–61why, one step back
60```
61

Add cli support (#1855)Tom Christiebefore adoptionee9250d

lines 62–69why, one step back
62Which now allows us to use HTTPX directly from the command-line...
6364![httpx --help](img/httpx-help.png)6566Sending a request...6768![httpx http://httpbin.org/json](img/httpx-request.png)69

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 70–71why, one step back
70## Features
71

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 72why, one step back
72HTTPX builds on the well-established usability of `requests`, and gives you:

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 73–79why, one step back
73
74* A broadly [requests-compatible API](compatibility.md).75* Standard synchronous interface, but with [async support if you need it](async.md).76* HTTP/1.1 [and HTTP/2 support](http2.md).77* 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).78* Strict timeouts everywhere.79* Fully type annotated.

Update README.md (#1291)Tom Christiebefore adoptionff0febb

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

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 81–108why, one step back
81
82Plus all the standard features of `requests`...8384* International Domains and URLs85* Keep-Alive & Connection Pooling86* Sessions with Cookie Persistence87* Browser-style SSL Verification88* Basic/Digest Authentication89* Elegant Key/Value Cookies90* Automatic Decompression91* Automatic Content Decoding92* Unicode Response Bodies93* Multipart File Uploads94* HTTP(S) Proxy Support95* Connection Timeouts96* Streaming Downloads97* .netrc Support98* Chunked Requests99100## Documentation101102For a run-through of all the basics, head over to the [QuickStart](quickstart.md).103104For more advanced topics, see the [Advanced Usage](advanced.md) section,105the [async support](async.md) section, or the [HTTP/2](http2.md) section.106107The [Developer Interface](api.md) provides a comprehensive API reference.108

Refine project workflow (#1534)Tom Christiebefore adoption437b55c

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

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

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

List 'click' and 'rich' in the project dependencies (#1858)Tom Christiebefore adoption7e01677

line 117why, one step back
117 * `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)*

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

line 118why, one step back
118* `certifi` - SSL certificates.

Add `charset_normalizer` detection. (#1791)Tom Christiebefore adoptionacb5e6a

line 119why, one step back
119* `charset_normalizer` - Charset auto-detection.

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 120–122why, one step back
120* `rfc3986` - URL parsing & normalization.
121 * `idna` - Internationalized domain name support.122* `sniffio` - Async library autodetection.

List 'click' and 'rich' in the project dependencies (#1858)Tom Christiebefore adoption7e01677

lines 123–125why, one step back
123* `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)*
124* `click` - Command line client support. *(Optional, with `httpx[cli]`)*125* `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)*

Tidy up the formatting of HTTP/2 requests (#1860)Tom Christiebefore adoptione1abaf1

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

Drop urllib3 in favor of public gist (#1182)Florimond Mancabefore adoption8fa8765

lines 127–154why, one step back
127
128A huge amount of credit is due to `requests` for the API layout that129much of this work follows, as well as to `urllib3` for plenty of design130inspiration around the lower-level networking details.131132## Installation133134Install with pip:135136```shell137$ pip install httpx138```139140Or, to include the optional HTTP/2 support, use:141142```shell143$ pip install httpx[http2]144```145146To include the optional brotli decoder support, use:147148```shell149$ pip install httpx[brotli]150```151152HTTPX requires Python 3.6+153154[sync-support]: https://github.com/encode/httpx/issues/572