CookieJar.extract_cookies(response, request)
Extract cookies from HTTP response and store them in the CookieJar
, where allowed by policy.
The CookieJar
will look for allowable Set-Cookie and Set-Cookie2 headers in the response argument, and store cookies as appropriate (subject to the CookiePolicy.set_ok()
method’s approval).
The response object (usually the result of a call to urllib.request.urlopen()
, or similar) should support an info()
method, which returns an email.message.Message
instance.
The request object (usually a urllib.request.Request
instance) must support the methods get_full_url()
, get_host()
, unverifiable()
, and origin_req_host
attribute, as documented by urllib.request
. The request is used to set default values for cookie-attributes as well as for checking that the cookie is allowed to be set.
Changed in version 3.3: request object needs origin_req_host
attribute. Dependency on a deprecated method get_origin_req_host()
has been removed.
Please login to continue.