README.md
This file
Path
README.md
175 lines · 4.1 KiB · Markdown
Last changed by
Truckin' onTom Christiebefore adoption6b60d95
History of this fileTake it
StuffTom Christiebefore adoption30530d4
lines 1–2why, one step back1# HTTPCore2Truckin' onTom Christiebefore adoption6b60d95
line 3why, one step back3A proposal for [requests III](https://github.com/kennethreitz/requests3).Update READMETom Christiebefore adoption665743a
line 4why, one step back4Truckin' onTom Christiebefore adoption6b60d95
line 5why, one step back5## Feature supportUpdate READMETom Christiebefore adoption665743a
line 6why, one step back6Truckin' onTom Christiebefore adoption6b60d95
lines 7–10why, one step back7* `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 back11Truckin' onTom Christiebefore adoption6b60d95
line 12why, one step back12Plus all the standard features of requests...Update READMETom Christiebefore adoption665743a
line 13why, one step back13Truckin' onTom Christiebefore adoption6b60d95
lines 14–28why, one step back14* International Domains and URLs15* 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 RequestsUpdate READMETom Christiebefore adoption665743a
line 29why, one step back29Update README.mdTom Christiebefore adoption0d3eb0e
line 30why, one step back30## UsageUpdate README.mdTom Christiebefore adoption01a3c09
line 31why, one step back31Update README.mdTom Christiebefore adoption337eb70
lines 32–33why, one step back32Making a request:33StuffTom Christiebefore adoption30530d4
line 34why, one step back34```pythonTruckin' onTom Christiebefore adoption6b60d95
lines 35–42why, one step back35>>> import httpcore36>>>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 back43```44Truckin' onTom Christiebefore adoption6b60d95
line 45why, one step back45Alternatively, thread-synchronous requests:StuffTom Christiebefore adoption30530d4
lines 46–47why, one step back4647```pythonTruckin' onTom Christiebefore adoption6b60d95
lines 48–55why, one step back48>>> import httpcore49>>>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 back56```57Truckin' onTom Christiebefore adoption6b60d95
line 58why, one step back58---StuffTom Christiebefore adoption30530d4
line 59why, one step back59Truckin' onTom Christiebefore adoption6b60d95
line 60why, one step back60## API ReferenceUpdate READMETom Christiebefore adoption68b80dc
line 61why, one step back61Truckin' onTom Christiebefore adoption6b60d95
line 62why, one step back62#### `Client([ssl], [timeout], [pool_limits], [max_redirects])`Update READMETom Christiebefore adoption68b80dc
line 63why, one step back63Truckin' onTom Christiebefore adoption6b60d95
lines 64–74why, one step back64* `.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 back75Truckin' onTom Christiebefore adoption6b60d95
line 76why, one step back76### ModelsREADME tweaksTom Christiebefore adoption8e1a263
line 77why, one step back77Truckin' onTom Christiebefore adoption6b60d95
line 78why, one step back78#### `Response(...)`Update README for 0.2.0Tom Christiebefore adoptionbb3d452
line 79why, one step back79Truckin' onTom Christiebefore adoption6b60d95
lines 80–98why, one step back80* `.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 back99Truckin' onTom Christiebefore adoption6b60d95
lines 100–126why, one step back100#### `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.*126Update README for 0.2.0Tom Christiebefore adoptionbb3d452
line 127why, one step back127```pythonTruckin' onTom Christiebefore adoption6b60d95
lines 128–129why, one step back128>>> Origin('https://example.org') == Origin('HTTPS://EXAMPLE.ORG:443')129TrueREADME tweaksTom Christiebefore adoption8e1a263
lines 130–131why, one step back130```131Truckin' onTom Christiebefore adoption6b60d95
lines 132–134why, one step back132* `.is_ssl` - **bool**133* `.host` - **str**134* `.port` - **int**Added proxy exampleTom Christiebefore adoption87b21b0
line 135why, one step back135Truckin' onTom Christiebefore adoption6b60d95
line 136why, one step back136#### `Headers(headers)`Added proxy exampleTom Christiebefore adoption87b21b0
line 137why, one step back137Truckin' onTom Christiebefore adoption6b60d95
lines 138–139why, one step back138*A case-insensitive multi-dict.*139Added proxy exampleTom Christiebefore adoption87b21b0
line 140why, one step back140```pythonTruckin' onTom Christiebefore adoption6b60d95
lines 141–144why, one step back141>>> headers = Headers({'Content-Type': 'application/json'})142>>> headers['content-type']143'application/json'144```Added proxy exampleTom Christiebefore adoption87b21b0
line 145why, one step back145Truckin' onTom Christiebefore adoption6b60d95
line 146why, one step back146___Added proxy exampleTom Christiebefore adoption87b21b0
line 147why, one step back147Truckin' onTom Christiebefore adoption6b60d95
line 148why, one step back148## Alternate backendsAdded proxy exampleTom Christiebefore adoption87b21b0
line 149why, one step back149Truckin' onTom Christiebefore adoption6b60d95
line 150why, one step back150### `SyncClient`Added proxy exampleTom Christiebefore adoption87b21b0
line 151why, one step back151Truckin' onTom Christiebefore adoption6b60d95
line 152why, one step back152A thread-synchronous client.Added proxy exampleTom Christiebefore adoption87b21b0
line 153why, one step back153Truckin' onTom Christiebefore adoption6b60d95
line 154why, one step back154### `TrioClient`Added proxy exampleTom Christiebefore adoption87b21b0
line 155why, one step back155Truckin' onTom Christiebefore adoption6b60d95
line 156why, one step back156*TODO*Added proxy exampleTom Christiebefore adoption87b21b0
line 157why, one step back157Truckin' onTom Christiebefore adoption6b60d95
line 158why, one step back158---Added proxy exampleTom Christiebefore adoption87b21b0
line 159why, one step back159Truckin' onTom Christiebefore adoption6b60d95
line 160why, one step back160## The StackImprove GatewayService exampleTom Christiebefore adoption9d59a5a
line 161why, one step back161Truckin' onTom Christiebefore adoption6b60d95
line 162why, one step back162The `httpcore` client builds up behavior in a modular way.Improve GatewayService exampleTom Christiebefore adoption9d59a5a
line 163why, one step back163Truckin' onTom Christiebefore adoption6b60d95
line 164why, one step back164This 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 back165Truckin' onTom Christiebefore adoption6b60d95
line 166why, one step back166You 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 back167Truckin' onTom Christiebefore adoption6b60d95
lines 168–175why, one step back168* `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.