skip login if cookies are present

This commit is contained in:
Mike Fährmann
2017-07-17 10:33:36 +02:00
parent 726c6f01ae
commit 0610ae5000
6 changed files with 22 additions and 12 deletions

View File

@@ -80,6 +80,15 @@ class Extractor():
response.encoding = encoding
return response
def _check_cookies(self, cookienames, domain=None):
"""Return True if all 'cookienames' exist in the current session"""
for name in cookienames:
try:
self.session.cookies._find(name, domain)
except KeyError:
return False
return True
class AsynchronousExtractor(Extractor):