index.md
This file
Path
docs/index.md
152 lines · 4.2 KiB · Markdown
Last changed by
Docs tweaks (#2075)Tom Christiebefore adoption2072aa2
History of this fileTake it
The walk stopped after 200 commits: lines older than ca5f524 point at it.
Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
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'>Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
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.2526---27Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 28why, one step back28Install HTTPX using pip:Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
line 29why, one step back29Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 30why, one step back30```shellVersion 0.20 (#1890)Tom Christiebefore adoption35164b7
line 31why, one step back31$ pip install httpxAdd cli support (#1855)Tom Christiebefore adoptionee9250d
lines 32–33why, one step back32```33Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 34why, one step back34Now, let's get started:Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 35why, one step back35Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 36–48why, one step back36```pycon37>>> import httpx38>>> r = httpx.get('https://www.example.org/')39>>> r40<Response [200 OK]>41>>> r.status_code4220043>>> r.headers['content-type']44'text/html; charset=UTF-8'45>>> r.text46'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'47```48Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 49why, one step back49Or, using the command-line client.Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
line 50why, one step back50Add cli support (#1855)Tom Christiebefore adoptionee9250d
lines 51–52why, one step back51```shell52# The command line client is an optional dependency.Version 0.20 (#1890)Tom Christiebefore adoption35164b7
line 53why, one step back53$ pip install 'httpx[cli]'Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 54–55why, one step back54```55Add cli support (#1855)Tom Christiebefore adoptionee9250d
lines 56–63why, one step back56Which now allows us to use HTTPX directly from the command-line...57585960Sending a request...616263Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 64–65why, one step back64## Features65Add cli support (#1855)Tom Christiebefore adoptionee9250d
line 66why, one step back66HTTPX builds on the well-established usability of `requests`, and gives you:Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 67–102why, one step back6768* A broadly [requests-compatible API](compatibility.md).69* Standard synchronous interface, but with [async support if you need it](async.md).70* HTTP/1.1 [and HTTP/2 support](http2.md).71* 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).72* Strict timeouts everywhere.73* Fully type annotated.74* 100% test coverage.7576Plus all the standard features of `requests`...7778* International Domains and URLs79* Keep-Alive & Connection Pooling80* Sessions with Cookie Persistence81* Browser-style SSL Verification82* Basic/Digest Authentication83* Elegant Key/Value Cookies84* Automatic Decompression85* Automatic Content Decoding86* Unicode Response Bodies87* Multipart File Uploads88* HTTP(S) Proxy Support89* Connection Timeouts90* Streaming Downloads91* .netrc Support92* Chunked Requests9394## Documentation9596For a run-through of all the basics, head over to the [QuickStart](quickstart.md).9798For more advanced topics, see the [Advanced Usage](advanced.md) section,99the [async support](async.md) section, or the [HTTP/2](http2.md) section.100101The [Developer Interface](api.md) provides a comprehensive API reference.102Refine project workflow (#1534)Tom Christiebefore adoption437b55c
line 103why, one step back103To find out about tools that integrate with HTTPX, see [Third Party Packages](third_party_packages.md).Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 104–111why, one step back104105## Dependencies106107The HTTPX project relies on these excellent libraries:108109* `httpcore` - The underlying transport implementation for `httpx`.110 * `h11` - HTTP/1.1 support.111* `certifi` - SSL certificates.Add `charset_normalizer` detection. (#1791)Tom Christiebefore adoptionacb5e6a
line 112why, one step back112* `charset_normalizer` - Charset auto-detection.Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
lines 113–115why, one step back113* `rfc3986` - URL parsing & normalization.114 * `idna` - Internationalized domain name support.115* `sniffio` - Async library autodetection.SOCKS proxy support (#2034)Tom Christiebefore adoption8dc9b6b
lines 116–120why, one step back116117As well as these optional installs:118119* `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)*120* `socksio` - SOCKS proxy support. *(Optional, with `httpx[socks]`)*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)*Add raw_path to scope in ASGITransport (#1357)Simon Willisonbefore adoptionca5f524
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