Urllib2 and timeouts

J

Johny

In my script I started using urllib2 to connect to a list of
servers.It works well but only until a server from the list is not
available.Then if it is down , there is a timeout and my script ends
with the error.
So, if I have a list of 10 servers, and the second from the list is
not available , no others are used.
Is there a way how to solve that problem, so that servers after the
server that is not available will be used too?
Thanks for help
L.
 
L

Larry Bates

Johny said:
In my script I started using urllib2 to connect to a list of
servers.It works well but only until a server from the list is not
available.Then if it is down , there is a timeout and my script ends
with the error.
So, if I have a list of 10 servers, and the second from the list is
not available , no others are used.
Is there a way how to solve that problem, so that servers after the
server that is not available will be used too?
Thanks for help
L.
Wrap your connection inside a try: block. That way you can catch
the exception and continue your loop.

-Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top