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

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -