mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 15:35:05 +02:00
Avoid reassignment with incompatible types
This commit is contained in:
parent
2a59f76170
commit
8ff2e198e8
1 changed files with 11 additions and 10 deletions
|
|
@ -178,18 +178,19 @@ class KitIpdCrawler(HttpCrawler):
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
etag = resp.headers.get("ETag")
|
etag_header = resp.headers.get("ETag")
|
||||||
last_modified = resp.headers.get("Last-Modified")
|
last_modified_header = resp.headers.get("Last-Modified")
|
||||||
|
|
||||||
try:
|
if last_modified_header:
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified#directives
|
try:
|
||||||
datetime_format = "%a, %d %b %Y %H:%M:%S GMT"
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified#directives
|
||||||
last_modified = datetime.strptime(last_modified, datetime_format)
|
datetime_format = "%a, %d %b %Y %H:%M:%S GMT"
|
||||||
except ValueError:
|
last_modified = datetime.strptime(last_modified_header, datetime_format)
|
||||||
# last_modified remains None
|
except ValueError:
|
||||||
pass
|
# last_modified remains None
|
||||||
|
pass
|
||||||
|
|
||||||
return etag, last_modified
|
return etag_header, last_modified
|
||||||
|
|
||||||
async def get_page(self) -> Tuple[BeautifulSoup, str]:
|
async def get_page(self) -> Tuple[BeautifulSoup, str]:
|
||||||
async with self.session.get(self._url) as request:
|
async with self.session.get(self._url) as request:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue