Added exception handling during get
This commit is contained in:
parent
a9a07aabea
commit
5ca786b1ae
10
main.py
10
main.py
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue