All I want to do is timeout a function if it does not return before that
It all started because urllib2 supports timeout for urlopen
, but not for reading part
and my program hangs. Changing defaulttimeout
for sockets does not work. Using signal.sigalrm
does not work. I can't switch to requests because then I will have to rewrite and test a lot more.
I DON'T want to make a thread run the function and then timeout the thread, I want to timeout the function. Any ideas how?