index.md
This file
Path
docs/index.md
152 lines · 4.5 KiB · Markdown
Last changed by
Version 0.21 release notes (#1938)Tom Christiebefore adoptionb4f6069
History of this fileTake 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 back1<p align="center" style="margin: 0 0 10px">Update butterfly logo (#1382)Tom Christiebefore adoptionceccb96
line 2why, one step back2 <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 back3</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!!! noteVersion 0.21 release notes (#1938)Tom Christiebefore adoptionb4f6069
line 28why, one step back28 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 back2930---31Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 32why, one step back32Install HTTPX using pip:Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
line 33why, one step back33Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 34why, one step back34```shellVersion 0.20 (#1890)Tom Christiebefore adoption35164b7
line 35why, one step back35$ pip install httpxAdd cli support (#1855)Tom Christiebefore adoptionee9250d
lines 36–37why, one step back36```37Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 38why, one step back38Now, let's get started:Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 39why, one step back39Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
lines 40–52why, one step back40```pycon41>>> 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```52Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 53why, one step back53Or, using the command-line client.Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
line 54why, one step back54Add cli support (#1855)Tom Christiebefore adoptionee9250d
lines 55–56why, one step back55```shell56# The command line client is an optional dependency.Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 57why, one step back57$ pip install 'httpx[cli]'Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
lines 58–59why, one step back58```59Add cli support (#1855)Tom Christiebefore adoptionee9250d
lines 60–67why, one step back60Which now allows us to use HTTPX directly from the command-line...61626364Sending a request...656667Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
lines 68–69why, one step back68## Features69Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 70why, one step back70HTTPX 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 back7172* 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.106Refine project workflow (#1534)Tom Christiebefore adoption437b55c
line 107why, one step back107To 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–114why, one step back108109## Dependencies110111The HTTPX project relies on these excellent libraries:112113* `httpcore` - The underlying transport implementation for `httpx`.114 * `h11` - HTTP/1.1 support.List 'click' and 'rich' in the project dependencies (#1858)Tom Christiebefore adoption7e01677
line 115why, one step back115 * `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)*Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
line 116why, one step back116* `certifi` - SSL certificates.Add `charset_normalizer` detection. (#1791)Tom Christiebefore adoptionacb5e6a
line 117why, one step back117* `charset_normalizer` - Charset auto-detection.Fix automatic .read() when Response instances are created with content=<str> (#1324)Tom Christiebefore adoption666cbbd
lines 118–120why, one step back118* `rfc3986` - URL parsing & normalization.119 * `idna` - Internationalized domain name support.120* `sniffio` - Async library autodetection.List 'click' and 'rich' in the project dependencies (#1858)Tom Christiebefore adoption7e01677
lines 121–123why, one step back121* `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)*122* `click` - Command line client support. *(Optional, with `httpx[cli]`)*123* `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 124why, one step back124* `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 125–152why, one step back125126A huge amount of credit is due to `requests` for the API layout that127much of this work follows, as well as to `urllib3` for plenty of design128inspiration around the lower-level networking details.129130## Installation131132Install with pip:133134```shell135$ pip install httpx136```137138Or, to include the optional HTTP/2 support, use:139140```shell141$ pip install httpx[http2]142```143144To include the optional brotli decoder support, use:145146```shell147$ pip install httpx[brotli]148```149150HTTPX requires Python 3.6+151152[sync-support]: https://github.com/encode/httpx/issues/572