module documentation

requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports.

Class MockRequest Wraps a `requests.Request` to mimic a `urllib2.Request`.
Class MockResponse Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
Class RequestsCookieJar Compatibility class; is a cookielib.CookieJar, but exposes a dict interface.
Exception CookieConflictError There are two cookies that meet the criteria specified in the cookie jar. Use .get and .set and include domain and path args in order to be more specific.
Function cookiejar_from_dict Returns a CookieJar from a key/value dictionary.
Function create_cookie Make a cookie from underspecified parameters.
Function extract_cookies_to_jar Extract the cookies from the response into a CookieJar.
Function get_cookie_header Produce an appropriate Cookie header string to be sent with `request`, or None.
Function merge_cookies Add cookies to cookiejar and returns a merged CookieJar.
Function morsel_to_cookie Convert a Morsel object into a Cookie containing the one k/v pair.
Function remove_cookie_by_name Unsets a cookie by name, by default over all domains and paths.
Function _copy_cookie_jar Undocumented
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): (source)

Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar

def create_cookie(name, value, **kwargs): (source)

Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie").

def extract_cookies_to_jar(jar, request, response): (source)

Extract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object

def get_cookie_header(jar, request): (source)

Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str

def merge_cookies(cookiejar, cookies): (source)

Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar

def morsel_to_cookie(morsel): (source)

Convert a Morsel object into a Cookie containing the one k/v pair.

def remove_cookie_by_name(cookiejar, name, domain=None, path=None): (source)

Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n).

def _copy_cookie_jar(jar): (source)

Undocumented