ciecplib.cookies module
Cookie handling for SAML ECP authentication
- class ciecplib.cookies.ECPCookieJar(filename=None, delayload=False, policy=None)
Bases:
RequestsCookieJar,MozillaCookieJarCustom 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
Trueif 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) –Trueif any cookie in the jar is a non-expiringshibsessioncookie 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, ifFalsejust emit warningsignore_discard (
bool, optional) – options to pass tohttp.cookiejar.FileCookieJar.load(), both default toTruein this usage.ignore_expires (
bool, optional) – options to pass tohttp.cookiejar.FileCookieJar.load(), both default toTruein this usage.