By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,994 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,994 IT Pros & Developers. It's quick & easy.

httplib timeout specification

P: 92
Seems like I am missing something. Shouldn't one be able to specify a time out on an HTTPConnection attempt? By default Python socket has no timeout (out of curiosity anyone know the history of this choice as it seems so prone to create problems) so I would expect to see one on the client's of socket. Is my only option to set the default timeout in the sockets module?
Mar 20 '08 #1
Share this Question
Share on Google+
2 Replies


Subsciber123
P: 87
Seems like I am missing something. Shouldn't one be able to specify a time out on an HTTPConnection attempt? By default Python socket has no timeout (out of curiosity anyone know the history of this choice as it seems so prone to create problems) so I would expect to see one on the client's of socket. Is my only option to set the default timeout in the sockets module?
No timeouts in python sockets ??
Expand|Select|Wrap|Line Numbers
  1. import socket
  2. sock=socket.socket()
  3. sock.settimeout(8.2)
Mar 21 '08 #2

P: 92
I know there are timeouts in sockets, but I want them in HTTPConnection objects. Either I need to import sockets and change the timeout for all sockets (which may be undesirable) or leave it at no timeout for an HTTP connection. The side question was, is there a valid/useful reason the default timeout for sockets is None thus causing potential locks in every python program.
Mar 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.