Skip to content
Myr

index.md

This file

Path

docs/index.md

134 lines · 4.1 KiB · Markdown

Last changed by

Alpha note, and recommendations on pinning versions (#590)Tom Christiebefore adoptionc08ae77

History of this file

Take it

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

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 1–26why, one step back
1<p align="center" style="margin: 0 0 10px">
2 <img width="350" height="208" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/logo.jpg" alt='HTTPX'>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://travis-ci.org/encode/httpx">14 <img src="https://travis-ci.org/encode/httpx.svg?branch=master" alt="Build Status">15</a>16<a href="https://codecov.io/gh/encode/httpx">17 <img src="https://codecov.io/gh/encode/httpx/branch/master/graph/badge.svg" alt="Coverage">18</a>19<a href="https://pypi.org/project/httpx/">20 <img src="https://badge.fury.io/py/httpx.svg" alt="Package version">21</a>22</p>2324<em>A next-generation HTTP client for Python.</em>25</div>26

Client handles redirect + auth (#552)Tom Christiebefore adoption00e150f

line 27why, one step back
27HTTPX is an asynchronous client library that supports HTTP/1.1 and HTTP/2.

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

line 28why, one step back
28

Drop sync (#544)Tom Christiebefore adoption206c537

line 29why, one step back
29It can be used in high-performance async web frameworks, using either asyncio

Client handles redirect + auth (#552)Tom Christiebefore adoption00e150f

line 30why, one step back
30or trio, and is able to support making large numbers of concurrent requests.

Drop sync (#544)Tom Christiebefore adoption206c537

lines 31–32why, one step back
31
32!!! note

Alpha note, and recommendations on pinning versions (#590)Tom Christiebefore adoptionc08ae77

lines 33–36why, one step back
33 HTTPX should currently be considered in alpha. We'd love early users and feedback,
34 but would strongly recommend pinning your dependencies to the latest median35 release, so that you're able to properly review API changes between package36 updates. Currently you should be using `http==0.8.*`.

Drop sync (#544)Tom Christiebefore adoption206c537

line 37why, one step back
37

Alpha note, and recommendations on pinning versions (#590)Tom Christiebefore adoptionc08ae77

lines 38–43why, one step back
38 In particular, the 0.8 release switched HTTPX into focusing exclusively on
39 providing an async client, in order to move the project forward, and help40 us [change our approach to providing sync+async support][sync-support]. If41 you have been using the sync client, you may want to pin to `http==0.7.*`,42 and wait until our sync client is reintroduced.43

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 44–47why, one step back
44---
4546Let's get started...47

Client handles redirect + auth (#552)Tom Christiebefore adoption00e150f

line 48why, one step back
48The standard Python REPL does not allow top-level async statements.

Drop sync (#544)Tom Christiebefore adoption206c537

line 49why, one step back
49

Client handles redirect + auth (#552)Tom Christiebefore adoption00e150f

lines 50–51why, one step back
50To run these async examples you'll probably want to either use `ipython`,
51or use Python 3.8 with `python -m asyncio`.

Drop sync (#544)Tom Christiebefore adoption206c537

line 52why, one step back
52

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 53–54why, one step back
53```python
54>>> import httpx

Drop sync (#544)Tom Christiebefore adoption206c537

line 55why, one step back
55>>> r = await httpx.get('https://www.example.org/')

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 56–59why, one step back
56>>> r
57<Response [200 OK]>58>>> r.status_code59200

Response.protocol -> Response.http_version (#250)Tom Christiebefore adoptionc1ec1c3

line 60why, one step back
60>>> r.http_version

Force HTTP/1.1 on short-lived connections (#284)Seth Michael Larsonbefore adoptione7aa6d6

line 61why, one step back
61'HTTP/1.1'

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 62–69why, one step back
62>>> r.headers['content-type']
63'text/html; charset=UTF-8'64>>> r.text65'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'66```6768## Features69

Drop sync (#544)Tom Christiebefore adoption206c537

lines 70–71why, one step back
70HTTPX is a high performance asynchronous HTTP client, that builds on the
71well-established usability of `requests`, and gives you:

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

line 72why, one step back
72

Drop sync (#544)Tom Christiebefore adoption206c537

line 73why, one step back
73* A broadly requests-compatible API.

Better HTTP/2 defaults. (#584)Tom Christiebefore adoption30229f1

line 74why, one step back
74* HTTP/1.1 and [HTTP/2 support](http2.md).

Drop sync (#544)Tom Christiebefore adoption206c537

line 75why, one step back
75* Ability to [make requests directly to ASGI applications](advanced.md#calling-into-python-web-apps).

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 76–85why, one step back
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 Verification

Drop proxies parameter from the high level API (#485)Yeray Diaz Diazbefore adoption09db6ec

line 86why, one step back
86* Basic/Digest Authentication

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 87–91why, one step back
87* Elegant Key/Value Cookies
88* Automatic Decompression89* Automatic Content Decoding90* Unicode Response Bodies91* Multipart File Uploads

Drop sync (#544)Tom Christiebefore adoption206c537

line 92why, one step back
92* HTTP(S) Proxy Support

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 93–94why, one step back
93* Connection Timeouts
94* Streaming Downloads

Documented netrc support (#225)Can Sarıgölbefore adoption21939fd

line 95why, one step back
95* .netrc Support

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 96–101why, one step back
96* Chunked Requests
9798## Documentation99100For a run-through of all the basics, head over to the [QuickStart](quickstart.md).101

Better HTTP/2 defaults. (#584)Tom Christiebefore adoption30229f1

lines 102–103why, one step back
102For more advanced topics, see the [Advanced Usage](advanced.md) section,
103or the [HTTP/2](http2.md) section.

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 104–114why, one step back
104
105The [Developer Interface](api.md) provides a comprehensive API reference.106107## Dependencies108109The HTTPX project relies on these excellent libraries:110111* `h2` - HTTP/2 support.112* `h11` - HTTP/1.1 support.113* `certifi` - SSL certificates.114* `chardet` - Fallback auto-detection for response encoding.

Merge pull request #315 from cansarigol/hstspreload-docTom Christiebefore adoption67d96b6

line 115why, one step back
115* `hstspreload` - determines whether IDNA-encoded host should be only accessed via HTTPS.

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 116–121why, one step back
116* `idna` - Internationalized domain name support.
117* `rfc3986` - URL parsing & normalization.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 design

Fix typos, spelling issues, and grammar in docs (#426)Kyle Galbraithbefore adoptionb65bce5

line 122why, one step back
122inspiration around the lower-level networking details.

Enable mypy to discover type hints as specified in PEP 561 (#194)Andrew M. Whitebefore adoptionc7a5ce7

lines 123–132why, one step back
123
124## Installation125126Install with pip:127128```shell129$ pip install httpx130```131132HTTPX requires Python 3.6+

Alpha note, and recommendations on pinning versions (#590)Tom Christiebefore adoptionc08ae77

lines 133–134why, one step back
133
134[sync-support]: https://github.com/encode/httpx/issues/572