ciecplib.cookies module
Cookie handling for SAML ECP authentication
- class ciecplib.cookies.ECPCookieJar(filename=None, delayload=False, policy=None)
Bases:
RequestsCookieJar
,MozillaCookieJar
Custom cookie jar that stores cookies in the cURL format.
- save(filename=None, ignore_discard=False, ignore_expires=False)
Save cookies to a file.
- ciecplib.cookies.extract_session_cookie(jar, url)
Returns s session cookie for the given URL from the jar
- Parameters:
jar (
http.cookiejar.CookieJar
) – the cookie jar to checkurl (
str
) – the URL of the service that needs cookies
- Returns:
cookie (
http.cookiejar.Cookie
) – the relevant cookie- Raises:
ValueError – if no appropriate cookie is found
- ciecplib.cookies.has_session_cookies(jar, url)
Returns
True
if the given cookie jar has a session cookie we can use- Parameters:
jar (
http.cookiejar.CookieJar
) – the cookie jar to checkurl (
str
) – the URL of the service that needs cookies
- Returns:
can_reuse (
bool
) –True
if any cookie in the jar is a non-expiringshibsession
cookie for the given same domain asurl
- ciecplib.cookies.load_cookiejar(cookiefile, strict=True, ignore_discard=True, ignore_expires=True)
Load a cookie jar from a file
- Parameters:
cookiefile (
str
) – path to cookie jar filestrict (
bool
, optional) – ifTrue
(default), raise all exceptions as they occur, ifFalse
just emit warningsignore_discard (
bool
, optional) – options to pass tohttp.cookiejar.FileCookieJar.load()
, both default toTrue
in this usage.ignore_expires (
bool
, optional) – options to pass tohttp.cookiejar.FileCookieJar.load()
, both default toTrue
in this usage.