diff options
Diffstat (limited to 'pyload/network/CookieJar.py')
-rw-r--r-- | pyload/network/CookieJar.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pyload/network/CookieJar.py b/pyload/network/CookieJar.py new file mode 100644 index 000000000..3d39c66b9 --- /dev/null +++ b/pyload/network/CookieJar.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from time import time +from Cookie import SimpleCookie + +class CookieJar(SimpleCookie): + + def getCookie(self, name): + return self[name].value + + def setCookie(self, domain, name, value, path="/", exp=None, secure="FALSE"): + if not exp: exp = time() + 3600 * 24 * 180 + + self[name] = value + self[name]["domain"] = domain + self[name]["path"] = path + self[name]["expires"] = exp + if secure == "TRUE": + self[name]["secure"] = secure |