diff --git a/pybikes/deutschebahn.py b/pybikes/deutschebahn.py index a150c3866..07ce28d07 100644 --- a/pybikes/deutschebahn.py +++ b/pybikes/deutschebahn.py @@ -38,6 +38,7 @@ def auth_headers(self): def update(self, scraper=None): scraper = scraper or PyBikesScraper() + scraper.parse_cookies = False scraper.headers.update(self.auth_headers) super(DB, self).update(scraper) diff --git a/pybikes/utils.py b/pybikes/utils.py index cfb9911e9..62790364e 100644 --- a/pybikes/utils.py +++ b/pybikes/utils.py @@ -34,6 +34,7 @@ def __init__( session=None, requests_timeout=300, ssl_verification=True, + parse_cookies=True, ): self.headers = headers if isinstance(headers, dict) else {} self.headers.setdefault('User-Agent', user_agent) @@ -92,8 +93,9 @@ def request(self, url, method='GET', params=None, data=None, raw=False, if raw: data = response.content - if 'set-cookie' in response.headers: + if self.parse_cookies and 'set-cookie' in response.headers: self.headers['Cookie'] = response.headers['set-cookie'] + self.last_request = response if self.cachedict is not None: