Add cookie interfaces
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Christie · committed by GitHub · parent feae0a8 · Browse files · 1 file·+35 added−16 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+35 added−16 removed
- other:+35 added−16 removed
Provenance
- Commit
0717998- Tree
4b9329d- Author
Tom Christie <tom@tomchristie.com>- Committer
GitHub <noreply@github.com>- Parent
feae0a8
1 file changed+35 added−16 removed
modified:README.md+35 added-16 removed
10 unmodified lines11 </a>12 13 ## Feature support14 15-* `HTTP/1.1` and `HTTP/2` Support.15+* `HTTP/2` and `HTTP/1.1` support.16 * `async`/`await` support for non-blocking HTTP requests.17 * Strict timeouts everywhere by default.18 * Fully type annotated.19 * 100% test coverage.1 unmodified line21 Plus all the standard features of requests...22 23 * International Domains and URLs24 * Keep-Alive & Connection Pooling25-* Sessions with Cookie Persistence *TODO*25+* Sessions with Cookie Persistence26 * Browser-style SSL Verification27 * Basic/Digest Authentication *TODO - We have Basic, but not Digest yet.*28-* Elegant Key/Value Cookies *TODO*28+* Elegant Key/Value Cookies29 * Automatic Decompression30 * Automatic Content Decoding31 * Unicode Response Bodies32 * Multipart File Uploads *TODO - Request content currently supports URL encoded data, bytes, or async byte iterators.*38 unmodified lines71 ---72 73 ## Dependencies74 75-* `h11` - HTTP/1.1 support.75 * `h2` - HTTP/2 support.76+* `h11` - HTTP/1.1 support.77 * `certifi` - SSL certificates.78 * `chardet` - Fallback auto-detection for response encoding.79 * `idna` - Internationalized domain name support.80 * `rfc3986` - URL parsing & normalization.15 unmodified lines96 >>> client = Client()97 >>> response = client.get('https://example.org')98 ```99 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])`100+* `def __init__([auth], [cookies], [ssl], [timeout], [pool_limits], [max_redirects], [dispatch])`101+* `def .request(method, url, [content], [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`102+* `def .get(url, [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`103+* `def .options(url, [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`104+* `def .head(url, [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`105+* `def .post(url, [content], [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`106+* `def .put(url, [content], [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`107+* `def .patch(url, [content], [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`108+* `def .delete(url, [content], [query_params], [headers], [cookies], [auth], [stream], [allow_redirects], [ssl], [timeout])`109 * `def .prepare_request(request)`110 * `def .send(request, [stream], [allow_redirects], [ssl], [timeout])`111 * `def .close()`112 11 unmodified lines124 * `.text` - **str**125 * `.encoding` - **str**126 * `.is_redirect` - **bool**127 * `.request` - **Request**128-* `.cookies` - **Cookies** *TODO*128+* `.cookies` - **Cookies**129 * `.history` - **List[Response]**130 * `def .raise_for_status()` - **None**131 * `def .json()` - **Any** *TODO*132 * `def .read()` - **bytes**11 unmodified lines144 >>> request = Request("GET", "https://example.org", headers={'host': 'example.org'})145 >>> response = client.send(request)146 ```147 148-* `def __init__(method, url, query_params, content, headers)`148+* `def __init__(method, url, query_params, [content], [headers], [cookies])`149 * `.method` - **str** (Uppercased)150 * `.url` - **URL**151 * `.content` - **byte** or **byte async iterator**152 * `.headers` - **Headers**153+* `.cookies` - **Cookies**154 155 ### `URL`156 157 *A normalized, IDNA supporting URL.*43 unmodified lines201 >>> headers['content-type']202 'application/json'203 ```204 204-* `def __init__(headers)`205+* `def __init__(self, headers)`206 207+### `Cookies`208+209+*A dict-like cookie store.*210+211+```python212+>>> cookies = Cookies()213+>>> cookies.set("name", "value", domain="example.org")214+```215+216+* `def __init__(cookies: [dict, Cookies, CookieJar])`217+* `def extract_cookies(response)`218+* `def set_cookie_header(request)`219+* `def set(name, value, [domain], [path])`220+* `def get(name, [domain], [path])`221+* `def delete(name, [domain], [path])`222+* `def clear([domain], [path])`223+* *Standard mutable mapping interface*224+225 ___226 227 ## Alternate backends228 21 unmodified lines