how to deal with socket.error: (10060, 'Operation timed out')

JuHui phpbird at
Sat Mar 18 07:30:48 EST 2006

I wrote a script to get 100 pages from a server.
like below:

1:import httplib
2:conns = httplib.HTTPConnection("")
3:conn.request("GET", "/")

sometimes a socket error was raised.

  File "D:\usr\bin\lib\", line 627, in connect
    raise socket.error, msg
socket.error: (10060, 'Operation timed out')

how to catch this kind of error then retry the "GET" operation?

If I want to get many page on same server, which lib is the best
choice? I only know httplib,urllib and urllib2.
thanks a lot.

More information about the Python-list mailing list