Reputation: 1728
I'm looking to get more information about IOError: [Errno socket error] [Errno 10060]
when using urlopen in Python 2.7. I am using my personal 35MB/s Internet connection (no proxy).
I've been opening multiple webpages from various websites using a Python script and randomly get this error message from time to time:
webpage = urlopen('http://www.thewebpage.com')
IOError: [Errno socket error] [Errno 10060] A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond
This error appeared after trying to open pages from different websites. Therefore, it doesn't seem to be related exclusively to the opening of pages from one particular website. I also got this error using mechanize.
My questions are :
My script takes around an hour to run and having to rerun it due to this error is fairly unpleasant.
Upvotes: 1
Views: 4929
Reputation: 7012
Sending multiple requests to the same server in short succession could very well cause the server not to respond, since your requests might look like a ddos attack. You can catch the exception with a try-except clause, and try again.
Upvotes: 3