From 5db862a834c758b200970548fd670e5a7a42ffab Mon Sep 17 00:00:00 2001 From: Quentin Duchemin Date: Wed, 12 Apr 2023 23:24:00 +0200 Subject: [PATCH] Remove Walrus operator to keep Python 3.7 compat --- pychee/pychee.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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('=', '')