Another solution is using a deliberately misconfigured proxy: import socket socket.setdefaulttimeout(1) import urllib proxies = {'http': 'http://www.example.com:3128'} url = 'http://www.google.com/' opener = urllib.FancyURLopener(proxies) f = opener.open(url) print f.read() >From this code I get the following exception: "IOError: [Errno socket error] timed out" ...and that fits my needs nicely. -- Adam Monsen http://adammonsen.com/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4