Skip to content
Myr

index.md

This file

Path

docs/index.md

156 lines · 4.6 KiB · Markdown

Last changed by

SOCKS proxy support (#2034)Tom Christiebefore adoption8dc9b6b

History of this file

Take it

The walk stopped after 200 commits: lines older than 666cbbd point at it.

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

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

Version 0.21 release notes (#1938)Tom Christiebefore adoptionb4f6069

line 28why, one step back
28 The 0.21 release includes some improvements to the integrated command-line client. This latest version integrates against a re-designed version of `httpcore`. Both packages ought to automatically update to the required versions, but if you are seeing any issues then you should ensure that you have `httpx==0.21.*` and `httpcore==0.14.*` installed. See [the CHANGELOG](https://github.com/encode/httpx/blob/master/CHANGELOG.md) for more details.

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 29–31why, one step back
29
30---31

Version 0.20 (#1890)Tom Christiebefore adoption35164b7

line 32why, one step back
32Install HTTPX using pip:

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

line 33why, one step back
33

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 34why, one step back
34```shell

Version 0.20 (#1890)Tom Christiebefore adoption35164b7

line 35why, one step back
35$ pip install httpx

Add cli support (#1855)Tom Christiebefore adoptionee9250d

lines 36–37why, one step back
36```
37

Version 0.20 (#1890)Tom Christiebefore adoption35164b7

line 38why, one step back
38Now, let's get started:

Add cli support (#1855)Tom Christiebefore adoptionee9250d

line 39why, one step back
39

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 40–52why, one step back
40```pycon
41>>> import httpx42>>> r = httpx.get('https://www.example.org/')43>>> r44<Response [200 OK]>45>>> r.status_code4620047>>> r.headers['content-type']48'text/html; charset=UTF-8'49>>> r.text50'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'51```52

Add cli support (#1855)Tom Christiebefore adoptionee9250d

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

line 54why, one step back
54

Add cli support (#1855)Tom Christiebefore adoptionee9250d

lines 55–56why, one step back
55```shell
56# The command line client is an optional dependency.

Version 0.20 (#1890)Tom Christiebefore adoption35164b7

line 57why, one step back
57$ pip install 'httpx[cli]'

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 58–59why, one step back
58```
59

Add cli support (#1855)Tom Christiebefore adoptionee9250d

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 68–69why, one step back
68## Features
69

Add cli support (#1855)Tom Christiebefore adoptionee9250d

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 71–106why, one step back
71
72* A broadly [requests-compatible API](compatibility.md).73* Standard synchronous interface, but with [async support if you need it](async.md).74* HTTP/1.1 [and HTTP/2 support](http2.md).75* 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).76* Strict timeouts everywhere.77* Fully type annotated.78* 100% test coverage.7980Plus all the standard features of `requests`...8182* International Domains and URLs83* Keep-Alive & Connection Pooling84* Sessions with Cookie Persistence85* Browser-style SSL Verification86* Basic/Digest Authentication87* Elegant Key/Value Cookies88* Automatic Decompression89* Automatic Content Decoding90* Unicode Response Bodies91* Multipart File Uploads92* HTTP(S) Proxy Support93* Connection Timeouts94* Streaming Downloads95* .netrc Support96* Chunked Requests9798## Documentation99100For a run-through of all the basics, head over to the [QuickStart](quickstart.md).101102For more advanced topics, see the [Advanced Usage](advanced.md) section,103the [async support](async.md) section, or the [HTTP/2](http2.md) section.104105The [Developer Interface](api.md) provides a comprehensive API reference.106

Refine project workflow (#1534)Tom Christiebefore adoption437b55c

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 108–115why, one step back
108
109## Dependencies110111The HTTPX project relies on these excellent libraries:112113* `httpcore` - The underlying transport implementation for `httpx`.114 * `h11` - HTTP/1.1 support.115* `certifi` - SSL certificates.

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

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

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

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

SOCKS proxy support (#2034)Tom Christiebefore adoption8dc9b6b

lines 120–124why, one step back
120
121As well as these optional installs:122123* `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)*124* `socksio` - SOCKS proxy support. *(Optional, with `httpx[socks]`)*

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

lines 125–127why, one step back
125* `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)*
126* `click` - Command line client support. *(Optional, with `httpx[cli]`)*127* `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 128why, one step back
128* `async_generator` - Backport support for `contextlib.asynccontextmanager`. *(Only required for Python 3.6)*

Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd

lines 129–156why, one step back
129
130A huge amount of credit is due to `requests` for the API layout that131much of this work follows, as well as to `urllib3` for plenty of design132inspiration around the lower-level networking details.133134## Installation135136Install with pip:137138```shell139$ pip install httpx140```141142Or, to include the optional HTTP/2 support, use:143144```shell145$ pip install httpx[http2]146```147148To include the optional brotli decoder support, use:149150```shell151$ pip install httpx[brotli]152```153154HTTPX requires Python 3.6+155156[sync-support]: https://github.com/encode/httpx/issues/572