Added exception handling during get

This commit is contained in:
bitscuit 2021-05-08 18:15:32 +02:00
parent a9a07aabea
commit 5ca786b1ae
1 changed files with 8 additions and 2 deletions

10
main.py
View File

@ -21,8 +21,14 @@ while not urls.empty():
# Perform request
print("Fetching url '%s'..."%url, end="")
r = session.get(url)
print("\tdone")
try:
r = session.get(url)
print("\tdone")
except Exception as e:
print("\tfailed")
print(e)
finally:
r.close()
# Read response
if r.status_code != 200: