[issue8595] Explain the default timeout in http-client-related libraries

2021-07-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've put up the doc update PR:
https://github.com/python/cpython/pull/27087

I did not add a module level default timeouts to these modules because it seems 
to me most of the issue is users being unaware of the current global default, 
which is fixed by docs update; then it's easy to set the timeout when calling 
respective functions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2021-07-11 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 6.0 -> 7.0
pull_requests: +25635
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27087

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2020-12-28 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee: docs@python -> orsenthil
versions: +Python 3.10 -Python 2.6, Python 2.7, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-08-19 Thread Anders Sandvig

Changes by Anders Sandvig anders.sand...@gmail.com:


--
nosy: +anders.sandvig

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-08-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 That way, if _HTTP_DEFAULT_TIMEOUT is never set, it will use the the
 socket timeout. Admittedly I'd rather see all uses of module globals go 
 away, but I think this would be a good compromise.

Why not provide {httplib,urllib}.{set,get}defaulttimeout() instead?

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-08-19 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

On 8/19/2010 9:14 AM, Antoine Pitrou wrote:
 Why not provide {httplib,urllib}.{set,get}defaulttimeout() instead?

Yes, I'm assuming that's how _HTTP_DEFAULT_TIMEOUT would be set and queried.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-07-01 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I think you could preserve backward compatibility by doing something like the 
following (in httplib):

_sentinel = object()
__HTTP_DEFAULT_TIMEOUT = _sentinel

In httplib.HTTPConnection.__init__(), in Python 2.6.

   def __init__(self, host, port=None, strict=None,
timeout=None):
  if timeout is None:
 if _HTTP_DEFAULT_TIMEOUT is _sentinel:
timeout = socket._GLOBAL_DEFAULT_TIMEOUT
 else:
timeout = _HTTP_DEFAULT_TIMEOUT

That way, if _HTTP_DEFAULT_TIMEOUT is never set, it will use the the socket 
timeout. Admittedly I'd rather see all uses of module globals go away, but I 
think this would be a good compromise.

--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-05-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

I am not sure, there can be a default timeout value for client libraries like 
httplib and urllib2. 

Socket connection do have timeout and as you may have figured out already, the 
option in httplib and urllib methods is to set/override the 
socket._GLOBAL_DEFALT_TIMEOUT which is None by default (Wait indefinitely).

Since client libraries are using a global, setting it at once place (say at 
httplib) has same timeout applicable for other modules within the same process.

I see docs can highlight it more or perhaps link to sockets timeout information.

--
nosy: +orsenthil
title: Unexpected default timeout in http-client-related libraries - Explain 
the default timeout in http-client-related libraries

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-05-01 Thread Julian

Julian python_...@somethinkodd.com added the comment:

@orsenthil:

Consider the definition of httplib.HTTPConnection.__init__(), in Python 2.6.

   def __init__(self, host, port=None, strict=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):


This could be replaced with:

   def __init__(self, host, port=None, strict=None,
timeout=10):

or, perhaps better, 

   def __init__(self, host, port=None, strict=None,
timeout=httplib._HTTP_DEFAULT_TIMEOUT):

This timeout value is passed to the call in socket.create_connection, so I 
believe if it is overriden, it only applies to the relevant sockets and not to 
all sockets globally.

Note: I am not arguing here that this SHOULD be done - it would break existing 
applications, especially those that were written before Python 2.6 - merely 
that it COULD be done.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8595] Explain the default timeout in http-client-related libraries

2010-05-01 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Sun, May 02, 2010 at 03:45:09AM +, Julian wrote:
 Note: I am not arguing here that this SHOULD be done - it would
 break existing applications, especially those that were written
 before Python 2.6 - merely that it COULD be done.

I get your point, Julian. What I was worried about is, is it the
correct thing to do? Which I am not sure and I believe it is not as
httplib and urllib are not client themselves but are libraries to
build clients. httplib and urllib can be considered as convenient
interfaces over underlying sockets.

Breaking of existing apps is the next question, which should
definitely be avoided. And an explanation in the docs certainly seems
to be the way to go.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com