Set the timeout parameter:
r = requests.get(w, verify=False, timeout=10) # 10 seconds
Changes in version 2.25.1
The code above will cause the call to requests.get()
to timeout if the connection or delays between reads takes more than ten seconds. See: https://docs.python-requests.org/en/master/user/advanced/#timeouts