warn about cookies expiring in less than 24 hours
requires an expiration timestamp, so this only works with cookies from a cookies.txt file
This commit is contained in:
parent
b17e2dcf93
commit
ed317bfcf1
@ -371,8 +371,16 @@ class Extractor():
|
|||||||
for cookie in self._cookiejar:
|
for cookie in self._cookiejar:
|
||||||
if cookie.name in names and (
|
if cookie.name in names and (
|
||||||
not domain or cookie.domain == domain):
|
not domain or cookie.domain == domain):
|
||||||
if cookie.expires and cookie.expires < now:
|
if cookie.expires:
|
||||||
self.log.warning("Cookie '%s' has expired", cookie.name)
|
diff = int(cookie.expires - now)
|
||||||
|
if diff <= 0:
|
||||||
|
self.log.warning(
|
||||||
|
"Cookie '%s' has expired", cookie.name)
|
||||||
|
elif diff <= 86400:
|
||||||
|
hours = diff // 3600
|
||||||
|
self.log.warning(
|
||||||
|
"Cookie '%s' will expire in less than %s hour%s",
|
||||||
|
cookie.name, hours + 1, "s" if hours else "")
|
||||||
else:
|
else:
|
||||||
names.discard(cookie.name)
|
names.discard(cookie.name)
|
||||||
if not names:
|
if not names:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user