diff --git a/pychee/pychee.py b/pychee/pychee.py index 3b2a14c..78bb00d 100644 --- a/pychee/pychee.py +++ b/pychee/pychee.py @@ -10,7 +10,7 @@ from requests import Session from urllib.parse import unquote -__version__ = '0.2.0' +__version__ = '0.2.1' class LycheeForbidden(Exception): """Raised when the Lychee request is unauthorized.""" @@ -83,7 +83,8 @@ def _set_csrf_header(self) -> None: Thus, a previous GET request is needed so this method works. """ - if (csrf_token := self.cookies.get(self._CSRF_COOKIE)) is not None: + csrf_token = self.cookies.get(self._CSRF_COOKIE) + if csrf_token is not None: if csrf_token != self.headers.get(self._CSRF_HEADER): self.headers[self._CSRF_HEADER] = unquote(csrf_token).replace('=', '')