urllib2的基于协议/连接的超时功能
timeout-urllib2的Python项目详细描述
urllib2的基于协议的超时功能。
Currently only support HTTP and HTTPS.
Achived by inheriting httplib.HTTPConnection and httplib.HTTPSConnection classes and provide a timeout version for both. Timeout has been carefully implemented per connection base. A HTTPConnectionTimeoutError or HTTPSConnectionTimeoutError would be raised instead of the general socket.error so that urlib2 wouldn’t throw out URLError exception when timeout is hit.