OpenQuizz
Une application de gestion des contenus pédagogiques
RequestsCookieJar Class Reference
Inheritance diagram for RequestsCookieJar:
Collaboration diagram for RequestsCookieJar:

Public Member Functions

def get (self, name, default=None, domain=None, path=None)
 
def set (self, name, value, **kwargs)
 
def iterkeys (self)
 
def keys (self)
 
def itervalues (self)
 
def values (self)
 
def iteritems (self)
 
def items (self)
 
def list_domains (self)
 
def list_paths (self)
 
def multiple_domains (self)
 
def get_dict (self, domain=None, path=None)
 
def __contains__ (self, name)
 
def __getitem__ (self, name)
 
def __setitem__ (self, name, value)
 
def __delitem__ (self, name)
 
def set_cookie (self, cookie, *args, **kwargs)
 
def update (self, other)
 
def __getstate__ (self)
 
def __setstate__ (self, state)
 
def copy (self)
 
def get_policy (self)
 

Detailed Description

Compatibility class; is a cookielib.CookieJar, but exposes a dict
interface.

This is the CookieJar we create by default for requests and sessions that
don't specify one, since some clients may expect response.cookies and
session.cookies to support dict operations.

Requests does not use the dict interface internally; it's just for
compatibility with external client code. All requests code should work
out of the box with externally provided instances of ``CookieJar``, e.g.
``LWPCookieJar`` and ``FileCookieJar``.

Unlike a regular CookieJar, this class is pickleable.

.. warning:: dictionary operations that are normally O(1) may be O(n).

Member Function Documentation

◆ __contains__()

def __contains__ (   self,
  name 
)

◆ __delitem__()

def __delitem__ (   self,
  name 
)
Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
``remove_cookie_by_name()``.

◆ __getitem__()

def __getitem__ (   self,
  name 
)
Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.

.. warning:: operation is O(n), not O(1).

◆ __getstate__()

def __getstate__ (   self)
Unlike a normal CookieJar, this class is pickleable.

◆ __setitem__()

def __setitem__ (   self,
  name,
  value 
)
Dict-like __setitem__ for compatibility with client code. Throws
exception if there is already a cookie of that name in the jar. In that
case, use the more explicit set() method instead.

◆ __setstate__()

def __setstate__ (   self,
  state 
)
Unlike a normal CookieJar, this class is pickleable.

◆ copy()

def copy (   self)
Return a copy of this RequestsCookieJar.

◆ get()

def get (   self,
  name,
  default = None,
  domain = None,
  path = None 
)
Dict-like get() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.

.. warning:: operation is O(n), not O(1).

◆ get_dict()

def get_dict (   self,
  domain = None,
  path = None 
)
Takes as an argument an optional domain and path and returns a plain
old Python dict of name-value pairs of cookies that meet the
requirements.

:rtype: dict

◆ get_policy()

def get_policy (   self)
Return the CookiePolicy instance used.

◆ items()

def items (   self)
Dict-like items() that returns a list of name-value tuples from the
jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
vanilla python dict of key value pairs.

.. seealso:: keys() and values().

◆ iteritems()

def iteritems (   self)
Dict-like iteritems() that returns an iterator of name-value tuples
from the jar.

.. seealso:: iterkeys() and itervalues().

◆ iterkeys()

def iterkeys (   self)
Dict-like iterkeys() that returns an iterator of names of cookies
from the jar.

.. seealso:: itervalues() and iteritems().

◆ itervalues()

def itervalues (   self)
Dict-like itervalues() that returns an iterator of values of cookies
from the jar.

.. seealso:: iterkeys() and iteritems().

◆ keys()

def keys (   self)
Dict-like keys() that returns a list of names of cookies from the
jar.

.. seealso:: values() and items().

◆ list_domains()

def list_domains (   self)
Utility method to list all the domains in the jar.

◆ list_paths()

def list_paths (   self)
Utility method to list all the paths in the jar.

◆ multiple_domains()

def multiple_domains (   self)
Returns True if there are multiple domains in the jar.
Returns False otherwise.

:rtype: bool

◆ set()

def set (   self,
  name,
  value,
**  kwargs 
)
Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.

◆ set_cookie()

def set_cookie (   self,
  cookie,
args,
**  kwargs 
)

◆ update()

def update (   self,
  other 
)
Updates this jar with cookies from another CookieJar or dict-like

◆ values()

def values (   self)
Dict-like values() that returns a list of values of cookies from the
jar.

.. seealso:: keys() and items().

The documentation for this class was generated from the following file: