Making a POST call instead of GET using urllib2
There’s a lot of stuff out there on urllib2 and POST calls, but I’m stuck on a problem.
There’s a lot of stuff out there on urllib2 and POST calls, but I’m stuck on a problem.
I’m writing a script(multi-threaded) to retrieve contents from a website, and the site’s not very stable so every now and then there’s hanging http request which cannot even be time-outed by socket.setdefaulttimeout(). Since I have no control over that website, the only thing I can do is to improve my codes but I’m running out of ideas right now.
urllib.urlretrieve returns silently even if the file doesn’t exist on the remote http server, it just saves a html page to the named file. For example: