Skip to content

Commit

Permalink
Remove Walrus operator to keep Python 3.7 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Chostakovitch committed Apr 12, 2023
1 parent 33d7a2c commit 5db862a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pychee/pychee.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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('=', '')

Expand Down

0 comments on commit 5db862a

Please sign in to comment.