Discussion:
[Tutor] Resetting state of http.client/httplib HTTPSConnection objects
Chris Down
2013-08-25 22:34:40 UTC
Permalink
I am experiencing intermittent issues where an exception will be raised when
calling getresponse(), which makes the entire connection stuck in Request-sent
state. Is it possible to reset to idle state somehow without reinstantiating
the HTTPSConnection? I ideally want to keep the connection to the server, and
just reset the state to idle so that I can make another request (like you would
usually do by calling getresponse()).
a.conn
<http.client.HTTPSConnection object at 0x7f8d7cb58bd0>
a.conn.getresponse()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.3/http/client.py", line 1143, in getresponse
response.begin()
File "/usr/lib64/python3.3/http/client.py", line 354, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python3.3/http/client.py", line 324, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: ''
a.conn.request("GET", "foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.3/http/client.py", line 1061, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python3.3/http/client.py", line 1089, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib64/python3.3/http/client.py", line 944, in putrequest
raise CannotSendRequest(self.__state)
http.client.CannotSendRequest: Request-sent
Alan Gauld
2013-08-26 00:23:52 UTC
Permalink
Post by Chris Down
I am experiencing intermittent issues where an exception will be raised when
calling getresponse(), which makes the entire connection stuck in Request-sent
state.
While this is technically within the remit of this list, since its
about a standard library module, I suspect you might be better
off asking on the main tutor list. It's at a deeper level of
skill/experience than most of the tutor queries.

But you may well get an answer here, it's just that the
main list would certainly consider this to be a valid query too.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
Chris Down
2013-08-26 09:28:47 UTC
Permalink
Post by Alan Gauld
While this is technically within the remit of this list, since its
about a standard library module, I suspect you might be better
off asking on the main tutor list. It's at a deeper level of
skill/experience than most of the tutor queries.
Hm, I guess I don't understand the remit of the two lists then. Tutor has
always seemed very... non-tutory. I'll post it there, anyway. Thanks!
Steven D'Aprano
2013-08-26 10:45:43 UTC
Permalink
Post by Chris Down
Post by Alan Gauld
While this is technically within the remit of this list, since its
about a standard library module, I suspect you might be better
off asking on the main tutor list. It's at a deeper level of
skill/experience than most of the tutor queries.
Hm, I guess I don't understand the remit of the two lists then. Tutor has
always seemed very... non-tutory. I'll post it there, anyway. Thanks!
It's not so much that your question is off-topic for this list -- it sort of is, but who cares, we often discuss things which are only tangentially related to "learning Python the language" -- but that the number of people on this list is smaller than the main python-***@python.org list. So for more advanced questions like this, you're more likely to get an answer from someone there, just by weight of numbers.
--
Steven
Chris Down
2013-08-26 13:53:00 UTC
Permalink
I'd be willing to bet that Alan simply foobar'd his answer - he _meant_ to
say the main python list, not the main tutor list.
I guessed that was what he meant. I posted on python-list, anyway.
ALAN GAULD
2013-08-26 14:30:24 UTC
Permalink
Oops, yes. That's absolutely correct.

Sorry about any confusion caused!
 
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
________________________________
Sent: Monday, 26 August 2013, 14:50
Subject: Re: [Tutor] Resetting state of http.client/httplib HTTPSConnection objects
Post by Chris Down
Post by Alan Gauld
While this is technically within the remit of this list, since its
about a standard library module, I suspect you might be better
off asking on the main tutor list. It's at a deeper level of
skill/experience than most of the tutor queries.
Hm, I guess I don't understand the remit of the two lists then. Tutor has
always seemed very... non-tutory. I'll post it there, anyway. Thanks!
_______________________________________________
http://mail.python.org/mailman/listinfo/tutor
I'd be willing to bet that Alan simply foobar'd his answer - he _meant_ to say the main python list, not the main tutor list.
-Bill
William Ray Wing
2013-08-26 13:50:26 UTC
Permalink
Post by Chris Down
Post by Alan Gauld
While this is technically within the remit of this list, since its
about a standard library module, I suspect you might be better
off asking on the main tutor list. It's at a deeper level of
skill/experience than most of the tutor queries.
Hm, I guess I don't understand the remit of the two lists then. Tutor has
always seemed very... non-tutory. I'll post it there, anyway. Thanks!
_______________________________________________
http://mail.python.org/mailman/listinfo/tutor
I'd be willing to bet that Alan simply foobar'd his answer - he _meant_ to say the main python list, not the main tutor list.

-Bill

Loading...