python - How can I force urllib2 to time out? -


i want to test application's handling of timeouts when grabbing data via urllib2, , want have way force request timeout.

short of finding very slow internet connection, method can use?

i seem remember interesting application/suite simulating these sorts of things. maybe knows link?

i use netcat listen on port 80 of local machine:

nc -l 80 

then use http://localhost/ request url in application. netcat answer @ http port won't ever give response, request guaranteed time out provided have specified timeout in urllib2.urlopen() call or calling socket.setdefaulttimeout().


Comments

Popular posts from this blog

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -