Skip to content
Myr

README.md

This file

Path

README.md

175 lines · 4.1 KiB · Markdown

Last changed by

Truckin' onTom Christiebefore adoption6b60d95

History of this file

Take it

StuffTom Christiebefore adoption30530d4

lines 1–2why, one step back
1# HTTPCore
2

Truckin' onTom Christiebefore adoption6b60d95

line 3why, one step back
3A proposal for [requests III](https://github.com/kennethreitz/requests3).

Update READMETom Christiebefore adoption665743a

line 4why, one step back
4

Truckin' onTom Christiebefore adoption6b60d95

line 5why, one step back
5## Feature support

Update READMETom Christiebefore adoption665743a

line 6why, one step back
6

Truckin' onTom Christiebefore adoption6b60d95

lines 7–10why, one step back
7* `HTTP/1.1` and `HTTP/2` Support.
8* `async`/`await` support for non-thread-blocking HTTP requests.9* Fully type annotated.10* 100% test coverage. *TODO - We're on ~97% right now*

Update READMETom Christiebefore adoption665743a

line 11why, one step back
11

Truckin' onTom Christiebefore adoption6b60d95

line 12why, one step back
12Plus all the standard features of requests...

Update READMETom Christiebefore adoption665743a

line 13why, one step back
13

Truckin' onTom Christiebefore adoption6b60d95

lines 14–28why, one step back
14* International Domains and URLs
15* Keep-Alive & Connection Pooling16* Sessions with Cookie Persistence *TODO*17* Browser-style SSL Verification18* Basic/Digest Authentication *TODO*19* Elegant Key/Value Cookies *TODO*20* Automatic Decompression21* Automatic Content Decoding22* Unicode Response Bodies23* Multipart File Uploads *TODO*24* HTTP(S) Proxy Support *TODO*25* Connection Timeouts26* Streaming Downloads27* .netrc Support *TODO*28* Chunked Requests

Update READMETom Christiebefore adoption665743a

line 29why, one step back
29

Update README.mdTom Christiebefore adoption0d3eb0e

line 30why, one step back
30## Usage

Update README.mdTom Christiebefore adoption01a3c09

line 31why, one step back
31

Update README.mdTom Christiebefore adoption337eb70

lines 32–33why, one step back
32Making a request:
33

StuffTom Christiebefore adoption30530d4

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

Truckin' onTom Christiebefore adoption6b60d95

lines 35–42why, one step back
35>>> import httpcore
36>>>37>>> client = httpcore.Client()38>>> response = await client.get('http://example.com')39>>> response.status_code40<StatusCode.ok: 200>41>>> response.text42'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n...'

StuffTom Christiebefore adoption30530d4

lines 43–44why, one step back
43```
44

Truckin' onTom Christiebefore adoption6b60d95

line 45why, one step back
45Alternatively, thread-synchronous requests:

StuffTom Christiebefore adoption30530d4

lines 46–47why, one step back
46
47```python

Truckin' onTom Christiebefore adoption6b60d95

lines 48–55why, one step back
48>>> import httpcore
49>>>50>>> client = httpcore.SyncClient()51>>> response = client.get('http://example.com')52>>> response.status_code53<StatusCode.ok: 200>54>>> response.text55'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n...'

StuffTom Christiebefore adoption30530d4

lines 56–57why, one step back
56```
57

Truckin' onTom Christiebefore adoption6b60d95

line 58why, one step back
58---

StuffTom Christiebefore adoption30530d4

line 59why, one step back
59

Truckin' onTom Christiebefore adoption6b60d95

line 60why, one step back
60## API Reference

Update READMETom Christiebefore adoption68b80dc

line 61why, one step back
61

Truckin' onTom Christiebefore adoption6b60d95

line 62why, one step back
62#### `Client([ssl], [timeout], [pool_limits], [max_redirects])`

Update READMETom Christiebefore adoption68b80dc

line 63why, one step back
63

Truckin' onTom Christiebefore adoption6b60d95

lines 64–74why, one step back
64* `.request(method, url, ...)`
65* `.get(url, ...)`66* `.options(url, ...)`67* `.head(url, ...)`68* `.post(url, ...)`69* `.put(url, ...)`70* `.patch(url, ...)`71* `.delete(url, ...)`72* `.prepare_request(request)`73* `.send(request, ...)`74* `.close()`

Update README.mdTom Christiebefore adoption01a3c09

line 75why, one step back
75

Truckin' onTom Christiebefore adoption6b60d95

line 76why, one step back
76### Models

README tweaksTom Christiebefore adoption8e1a263

line 77why, one step back
77

Truckin' onTom Christiebefore adoption6b60d95

line 78why, one step back
78#### `Response(...)`

Update README for 0.2.0Tom Christiebefore adoptionbb3d452

line 79why, one step back
79

Truckin' onTom Christiebefore adoption6b60d95

lines 80–98why, one step back
80* `.status_code` - **int**
81* `.reason_phrase` - **str**82* `.protocol` - `"HTTP/2"` or `"HTTP/1.1"`83* `.url` - **URL**84* `.headers` - **Headers**85* `.content` - **bytes**86* `.text` - **str**87* `.encoding` - **str**88* `.json()` - **Any** *TODO*89* `.read()` - **bytes**90* `.stream()` - **bytes iterator**91* `.raw()` - **bytes iterator**92* `.close()` - **None**93* `.is_redirect` - **bool**94* `.request` - **Request**95* `.cookies` - **Cookies** *TODO*96* `.history` - **List[Response]**97* `.raise_for_status()` - **Response** *TODO*98* `.next()` - **Response**

Update README for 0.2.0Tom Christiebefore adoptionbb3d452

line 99why, one step back
99

Truckin' onTom Christiebefore adoption6b60d95

lines 100–126why, one step back
100#### `Request(method, url, content, headers)`
101102...103104#### `URL(url, allow_relative=False)`105106*A normalized, IDNA supporting URL.*107108* `.scheme` - **str**109* `.authority` - **str**110* `.host` - **str**111* `.port` - **int**112* `.path` - **str**113* `.query` - **str**114* `.full_path` - **str**115* `.fragment` - **str**116* `.is_ssl` - **bool**117* `.origin` - **Origin**118* `.is_absolute_url` - **bool**119* `.is_relative_url` - **bool**120* `.copy_with([scheme], [authority], [path], [query], [fragment])` - **URL**121* `.resolve_with(url)` - **URL**122123#### `Origin(url)`124125*A normalized, IDNA supporting set of scheme/host/port info.*126

Update README for 0.2.0Tom Christiebefore adoptionbb3d452

line 127why, one step back
127```python

Truckin' onTom Christiebefore adoption6b60d95

lines 128–129why, one step back
128>>> Origin('https://example.org') == Origin('HTTPS://EXAMPLE.ORG:443')
129True

README tweaksTom Christiebefore adoption8e1a263

lines 130–131why, one step back
130```
131

Truckin' onTom Christiebefore adoption6b60d95

lines 132–134why, one step back
132* `.is_ssl` - **bool**
133* `.host` - **str**134* `.port` - **int**

Added proxy exampleTom Christiebefore adoption87b21b0

line 135why, one step back
135

Truckin' onTom Christiebefore adoption6b60d95

line 136why, one step back
136#### `Headers(headers)`

Added proxy exampleTom Christiebefore adoption87b21b0

line 137why, one step back
137

Truckin' onTom Christiebefore adoption6b60d95

lines 138–139why, one step back
138*A case-insensitive multi-dict.*
139

Added proxy exampleTom Christiebefore adoption87b21b0

line 140why, one step back
140```python

Truckin' onTom Christiebefore adoption6b60d95

lines 141–144why, one step back
141>>> headers = Headers({'Content-Type': 'application/json'})
142>>> headers['content-type']143'application/json'144```

Added proxy exampleTom Christiebefore adoption87b21b0

line 145why, one step back
145

Truckin' onTom Christiebefore adoption6b60d95

line 146why, one step back
146___

Added proxy exampleTom Christiebefore adoption87b21b0

line 147why, one step back
147

Truckin' onTom Christiebefore adoption6b60d95

line 148why, one step back
148## Alternate backends

Added proxy exampleTom Christiebefore adoption87b21b0

line 149why, one step back
149

Truckin' onTom Christiebefore adoption6b60d95

line 150why, one step back
150### `SyncClient`

Added proxy exampleTom Christiebefore adoption87b21b0

line 151why, one step back
151

Truckin' onTom Christiebefore adoption6b60d95

line 152why, one step back
152A thread-synchronous client.

Added proxy exampleTom Christiebefore adoption87b21b0

line 153why, one step back
153

Truckin' onTom Christiebefore adoption6b60d95

line 154why, one step back
154### `TrioClient`

Added proxy exampleTom Christiebefore adoption87b21b0

line 155why, one step back
155

Truckin' onTom Christiebefore adoption6b60d95

line 156why, one step back
156*TODO*

Added proxy exampleTom Christiebefore adoption87b21b0

line 157why, one step back
157

Truckin' onTom Christiebefore adoption6b60d95

line 158why, one step back
158---

Added proxy exampleTom Christiebefore adoption87b21b0

line 159why, one step back
159

Truckin' onTom Christiebefore adoption6b60d95

line 160why, one step back
160## The Stack

Improve GatewayService exampleTom Christiebefore adoption9d59a5a

line 161why, one step back
161

Truckin' onTom Christiebefore adoption6b60d95

line 162why, one step back
162The `httpcore` client builds up behavior in a modular way.

Improve GatewayService exampleTom Christiebefore adoption9d59a5a

line 163why, one step back
163

Truckin' onTom Christiebefore adoption6b60d95

line 164why, one step back
164This makes it easier to dig into an understand the behaviour of any one aspect in isolation, as well as making it easier to test or to adapt for custom behaviors.

Added proxy exampleTom Christiebefore adoption87b21b0

line 165why, one step back
165

Truckin' onTom Christiebefore adoption6b60d95

line 166why, one step back
166You can also use lower level components in isolation if required, eg. Use a `ConnectionPool` without providing sessions, redirects etc...

Added proxy exampleTom Christiebefore adoption87b21b0

line 167why, one step back
167

Truckin' onTom Christiebefore adoption6b60d95

lines 168–175why, one step back
168* `RedirectAdapter` - Adds redirect support.
169* `EnvironmentAdapter` - Adds `.netrc` and envvars such as `REQUESTS_CA_BUNDLE`.170* `CookieAdapter` - Adds cookie persistence.171* `AuthAdapter` - Adds authentication support.172* `ConnectionPool` - Connection pooling & keep alive.173 * `HTTPConnection` - A single connection.174 * `HTTP11Connection` - A single HTTP/1.1 connection.175 * `HTTP2Connection` - A single HTTP/2 connection, with multiple streams.