urllib.request.urlopen
has a timeout
option. However, when my internet is down that option does not seem to work.
import urllib
urllib.request.urlopen(url, timeout=1)
Hangs and eventually gives
URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
How can I impose a timeout when my internet is down?