Merge branch 'dev' into plugins-browsertrix

This commit is contained in:
Nick Sweeting 2024-02-22 04:51:31 -08:00
commit 1ea7ac168a
13 changed files with 88 additions and 36 deletions

View file

@ -179,7 +179,11 @@ def download_url(url: str, timeout: int=None) -> str:
if encoding is not None:
response.encoding = encoding
return response.text
try:
return response.text
except UnicodeDecodeError:
# if response is non-test (e.g. image or other binary files), just return the filename instead
return url.rsplit('/', 1)[-1]
@enforce_types
def get_headers(url: str, timeout: int=None) -> str: