Cookies

If a response contains some Cookies, you can quickly access them:

  1. >>> url = 'http://example.com/some/cookie/setting/url'
  2. >>> r = requests.get(url)
  3. >>> r.cookies['example_cookie_name']
  4. 'example_cookie_value'

To send your own cookies to the server, you can use the cookies parameter:

  1. >>> url = 'http://httpbin.org/cookies'
  2. >>> cookies = dict(cookies_are='working')
  3. >>> r = requests.get(url, cookies=cookies)
  4. >>> r.text
  5. '{"cookies": {"cookies_are": "working"}}'