Skip to content

Commit

Permalink
Use GET instead of HEAD for greater compatibility + close the connect…
Browse files Browse the repository at this point in the history
…ion automatically
  • Loading branch information
benoit74 committed Oct 23, 2023
1 parent 2a317c9 commit d487d65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,10 @@ def cleanup():
def check_url(url, user_agent, scope=None):
url = urllib.parse.urlparse(url)
try:
resp = requests.head(
with requests.get(
url.geturl(), stream=True, allow_redirects=True, timeout=(12.2, 27), headers={"User-Agent": user_agent}
)
resp.raise_for_status()
) as resp:
resp.raise_for_status()
except requests.exceptions.RequestException as exc:
print(f"failed to connect to {url.geturl()}: {exc}", flush=True)
raise SystemExit(1)
Expand Down

0 comments on commit d487d65

Please sign in to comment.