Skip to content
Myr

cookies docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent b72eb53 · Browse files · 1 file+30 added−1 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+30 added−1 removed

  • other:+30 added−1 removed

1 file+30 added−1 removed

modified:docs/user/quickstart.rst+30 added-1 removed
102 unmodified lines
103104If a header doesn't exist in the Response, its value defaults to ``None``::105106 >>> r.headers['X-Random']107 None107 None108109110Cookies111-------112113If a response contains some Cookies, you can get quick access to them::114115 # cookies test url116 >>> url = 'http://httpbin.org/cookies/set/requests-is/awesome'117118 >>> r = requests.get(url)119120 >>> print r.cookies121 {'requests-is': 'awesome'}122123The underlying CookieJar is also available for more advanced handing::124125 >>> r.request.cookiejar126 <cookielib.CookieJar>127128To send your own cookies to the server, you can use the ``cookies``129parameter::130131 >>> url = 'http://httpbin.org/cookies'132 >>> cookies = dict(cookies_are='working')133134 >>> r = requests.get(url, cookies=cookies)135 >>> r.content136 '{"cookies": {"cookies_are": "working"}}'