Skip to content
Myr

Merge pull request #3469 from roselma/patch-1

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

Add a bit about RequestsCookieJar to Cookies section

authored by Cory Benfield · committed by GitHub · parents be12b27, 07b7872 · Browse files · 1 file+13 added−0 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+13 added−0 removed

  • other:+13 added−0 removed

1 file+13 added−0 removed

modified:docs/user/quickstart.rst+13 added
414 unmodified lines
415416 >>> r = requests.get(url, cookies=cookies)417 >>> r.text418 '{"cookies": {"cookies_are": "working"}}'419 420Cookies are returned in a :class:`~requests.cookies.RequestsCookieJar`,421which acts like a ``dict`` but also offers a more complete interface,422suitable for use over multiple domains or paths. Cookie jars can423also be passed in to requests::424425 >>> jar = requests.cookies.RequestsCookieJar()426 >>> jar.set('tasty_cookie', 'yum', site='httpbin.org', path='/cookies')427 >>> jar.set('gross_cookie', 'blech', site='httpbin.org', path='/elsewhere')428 >>> url = 'http://httpbin.org/cookies'429 >>> r = requests.get(url, cookies=jar)430 >>> r.text431 '{"cookies": {"tasty_cookie": "yum"}}'432433434Redirection and History435-----------------------436437By default Requests will perform location redirection for all verbs except
87 unmodified lines