]> git.mxchange.org Git - fba.git/blobdiff - fba/helpers/cookies.py
Continued:
[fba.git] / fba / helpers / cookies.py
index 70f45cc2a1fdafd67875ce2ef2f1b0e88f2505af..5a35602bda672028f32f56088832742f35643926 100644 (file)
@@ -36,8 +36,20 @@ def get_all(domain: str) -> dict:
         raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
     elif domain == "":
         raise ValueError("Parameter 'domain' is empty")
-    elif not domain in _cookies:
+    elif not has(domain):
         raise Exception(f"domain='{domain}' has no cookies stored, maybe invoke store() first?")
 
     # DEBUG: print(f"DEBUG: _cookies[{domain}]()={len(_cookies[domain])} - EXIT!")
     return _cookies[domain]
+
+def has (domain: str) -> bool:
+    # DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
+    if not isinstance(domain, str):
+        raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
+    elif domain == "":
+        raise ValueError("Parameter 'domain' is empty")
+
+    has_cookies = domain in _cookies
+
+    # DEBUG: print(f"DEBUG: has_cookies='{has_cookies}' - EXIT!")
+    return has_cookies