mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
nicer timeout hints
This commit is contained in:
parent
651d6c4447
commit
c47398851b
3 changed files with 22 additions and 9 deletions
|
@ -15,7 +15,7 @@ from datetime import datetime
|
|||
from dateparser import parse as dateparser
|
||||
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
from requests.exceptions import RequestException, ReadTimeout
|
||||
from base32_crockford import encode as base32_encode # type: ignore
|
||||
from w3lib.encoding import html_body_declared_encoding, http_content_type_encoding
|
||||
|
||||
|
@ -186,10 +186,12 @@ def get_headers(url: str, timeout: int=None) -> str:
|
|||
headers={'User-Agent': WGET_USER_AGENT},
|
||||
verify=CHECK_SSL_VALIDITY,
|
||||
timeout=timeout,
|
||||
allow_redirects=True
|
||||
allow_redirects=True,
|
||||
)
|
||||
if response.status_code >= 400:
|
||||
raise RequestException
|
||||
except ReadTimeout:
|
||||
raise
|
||||
except RequestException:
|
||||
response = requests.get(
|
||||
url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue