import urllib.request, urllib.error, urllib.parse
socket.setdefaulttimeout(10)
req = urllib.request.Request('http://www.voidspace.org.uk')
response = urllib.request.urlopen(req)
Read timeout using either urllib2 or any other http library