mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 23:45:05 +02:00
Catch errors when requesting resource version
This commit is contained in:
parent
eb80c67535
commit
2193adadb4
1 changed files with 17 additions and 14 deletions
|
|
@ -198,6 +198,7 @@ class HttpCrawler(Crawler):
|
||||||
Requests the ETag and Last-Modified headers of a resource via a HEAD request.
|
Requests the ETag and Last-Modified headers of a resource via a HEAD request.
|
||||||
If no entity tag / modification date can be obtained, the according value will be None.
|
If no entity tag / modification date can be obtained, the according value will be None.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
async with self.session.head(resource_url) as resp:
|
async with self.session.head(resource_url) as resp:
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
@ -215,6 +216,8 @@ class HttpCrawler(Crawler):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return etag_header, last_modified
|
return etag_header, last_modified
|
||||||
|
except aiohttp.ClientError:
|
||||||
|
return None, None
|
||||||
|
|
||||||
async def run(self) -> None:
|
async def run(self) -> None:
|
||||||
self._request_count = 0
|
self._request_count = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue