Update README
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Christie · committed by Tom Christie · parent b6c27f0 · Browse files · 1 file·+33 added−38 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+33 added−38 removed
- other:+33 added−38 removed
Provenance
- Commit
58461d4- Tree
0e22a44- Author
Tom Christie <tom@tomchristie.com>- Committer
Tom Christie <tom@tomchristie.com>- Parent
b6c27f0
1 file changed+33 added−38 removed
modified:README.md+33 added-38 removed
20 unmodified lines21 Plus all the standard features of requests...22 23 * International Domains and URLs24 * Keep-Alive & Connection Pooling25-* Sessions with Cookie Persistence *TODO - Requires `adapters/cookies.py` implementation.*25+* Sessions with Cookie Persistence *TODO*26 * Browser-style SSL Verification27-* Basic/Digest Authentication *TODO - Requires `adapters/authentication.py` implementation.*27+* Basic/Digest Authentication *TODO*28 * Elegant Key/Value Cookies *TODO*29 * Automatic Decompression30 * Automatic Content Decoding31 * Unicode Response Bodies32 * Multipart File Uploads *TODO - Request content currently supports URL encoded data, bytes, or async byte iterators.*33 * HTTP(S) Proxy Support *TODO*34 * Connection Timeouts35 * Streaming Downloads36-* .netrc Support *TODO - Requires `adapters/environment.py` implementation.*36+* .netrc Support *TODO*37 * Chunked Requests38 39 ## Usage40 41-**Note**: Use `ipython` to try this from the console, since it supports `await`.42-41 Making a request:42 43 ```python44 >>> import httpcore45 >>> client = httpcore.Client()48->>> response = await client.get('https://example.com')46+>>> response = client.get('https://example.com')47 >>> response.status_code48 <StatusCode.ok: 200>49 >>> response.protocol50 'HTTP/2'51 >>> response.text52 '<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n...'53 ```54 57-Alternatively, thread-synchronous requests:55+Alternatively, async requests:56 57+**Note**: Use `ipython` to try this from the console, since it supports `await`.58+59 ```python60 >>> import httpcore61->>> client = httpcore.SyncClient()62->>> response = client.get('https://example.com')61+>>> client = httpcore.AsyncClient()62+>>> response = await client.get('https://example.com')63 >>> response.status_code64 <StatusCode.ok: 200>65 >>> response.protocol66 'HTTP/2'12 unmodified lines79 * `idna` - Internationalized domain name support.80 * `rfc3986` - URL parsing & normalization.81 * `brotlipy` - Decoding for "brotli" compressed responses. *(Optional)*82 83-A huge amount of credit is due to `requests`, for the API layout that83+A huge amount of credit is due to `requests` for the API layout that84 much of this work follows, as well as to `urllib3` for plenty of design85 inspiration around the lower level networking details.86 87 ---8 unmodified lines96 >>> client = Client()97 >>> response = await client.get('https://example.org')98 ```99 100-* `def __init__([ssl], [timeout], [pool_limits], [max_redirects])`101-* `async def .request(method, url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`102-* `async def .get(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`103-* `async def .options(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`104-* `async def .head(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`105-* `async def .post(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`106-* `async def .put(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`107-* `async def .patch(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`108-* `async def .delete(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`100+* `def __init__([ssl], [timeout], [pool_limits], [max_redirects], [dispatch])`101+* `def .request(method, url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`102+* `def .get(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`103+* `def .options(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`104+* `def .head(url, [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`105+* `def .post(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`106+* `def .put(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`107+* `def .patch(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`108+* `def .delete(url, [content], [query_params], [headers], [stream], [allow_redirects], [ssl], [timeout])`109 * `def .prepare_request(request)`110-* `async def .send(request, [stream], [allow_redirects], [ssl], [timeout])`111-* `async def .close()`110+* `def .send(request, [stream], [allow_redirects], [ssl], [timeout])`111+* `def .close()`112 113 ### `Response`114 115 *An HTTP response.*12 unmodified lines128 * `.cookies` - **Cookies** *TODO*129 * `.history` - **List[Response]**130 * `def .raise_for_status()` - **None**131 * `def .json()` - **Any** *TODO*132-* `async def .read()` - **bytes**133-* `async def .stream()` - **bytes iterator**134-* `async def .raw()` - **bytes iterator**135-* `async def .close()` - **None**136-* `async def .next()` - **Response**132+* `def .read()` - **bytes**133+* `def .stream()` - **bytes iterator**134+* `def .raw()` - **bytes iterator**135+* `def .close()` - **None**136+* `def .next()` - **Response**137 138 ### `Request`139 140 *An HTTP request. Can be constructed explicitly for more control over exactly65 unmodified lines206 ___207 208 ## Alternate backends209 210-### `SyncClient`210+### `AsyncClient`211 212-A thread-synchronous client.212+An asyncio client.213 214 ### `TrioClient`215 216 *TODO*1 unmodified line218 ---219 220 ## The Stack221 222-The `httpcore` client builds up behavior in a modular way.222+There are two main layers in the stack. The client handles redirection,223+cookie persistence (TODO), and authentication (TODO). The dispatcher224+handles sending the actual request and getting the response.225 224-This 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.225-226-You can also use lower level components in isolation if required, eg. Use a `ConnectionPool` without providing sessions, redirects etc...227-228-* `RedirectAdapter` - Adds redirect support.229-* `EnvironmentAdapter` - Adds `.netrc` and envvars such as `REQUESTS_CA_BUNDLE`.230-* `CookieAdapter` - Adds cookie persistence.231-* `AuthAdapter` - Adds authentication support.232-* `ConnectionPool` - Connection pooling & keep alive.226+* `Client` - Redirect, authentication, cookies etc.227+* `ConnectionPool(Dispatcher)` - Connection pooling & keep alive.228 * `HTTPConnection` - A single connection.229 * `HTTP11Connection` - A single HTTP/1.1 connection.230 * `HTTP2Connection` - A single HTTP/2 connection, with multiple streams.