http.cookiejar.CookiePolicy.domain_return_ok()

CookiePolicy.domain_return_ok(domain, request) Return false if cookies should not be returned, given cookie domain. This method is an optimization. It removes the need for checking every cookie with a particular domain (which might involve reading many files). Returning true from domain_return_ok() and path_return_ok() leaves all the work to return_ok(). If domain_return_ok() returns true for the cookie domain, path_return_ok() is called for the cookie path. Otherwise, path_return_ok() and r

http.cookiejar.CookiePolicy

class http.cookiejar.CookiePolicy This class is responsible for deciding whether each cookie should be accepted from / returned to the server.

http.cookiejar.CookieJar.set_policy()

CookieJar.set_policy(policy) Set the CookiePolicy instance to be used.

http.cookiejar.CookieJar.set_cookie_if_ok()

CookieJar.set_cookie_if_ok(cookie, request) Set a Cookie if policy says it’s OK to do so.

http.cookiejar.CookieJar.set_cookie()

CookieJar.set_cookie(cookie) Set a Cookie, without checking with policy to see whether or not it should be set.

http.cookiejar.CookieJar.make_cookies()

CookieJar.make_cookies(response, request) Return sequence of Cookie objects extracted from response object. See the documentation for extract_cookies() for the interfaces required of the response and request arguments.

http.cookiejar.CookieJar.extract_cookies()

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 insta

http.cookiejar.CookieJar.clear_session_cookies()

CookieJar.clear_session_cookies() Discard all session cookies. Discards all contained cookies that have a true discard attribute (usually because they had either no max-age or expires cookie-attribute, or an explicit discard cookie-attribute). For interactive browsers, the end of a session usually corresponds to closing the browser window. Note that the save() method won’t save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument.

http.cookiejar.CookieJar.clear()

CookieJar.clear([domain[, path[, name]]]) Clear some cookies. If invoked without arguments, clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified domain and URL path are removed. If given three arguments, then the cookie with the specified domain, path and name is removed. Raises KeyError if no matching cookie exists.

http.cookiejar.CookieJar.add_cookie_header()

CookieJar.add_cookie_header(request) Add correct Cookie header to request. If policy allows (ie. the rfc2965 and hide_cookie2 attributes of the CookieJar‘s CookiePolicy instance are true and false respectively), the Cookie2 header is also added when appropriate. The request object (usually a urllib.request..Request instance) must support the methods get_full_url(), get_host(), get_type(), unverifiable(), has_header(), get_header(), header_items(), add_unredirected_header() and origin_req_hos