Closed GoogleCodeExporter closed 9 years ago
I wrote httplib but I wanted to mean httplib2
Sorry
Original comment by mati...@gmail.com
on 3 Jun 2010 at 7:28
This should be fixed in trunk. Can you try and confirm that this doesn't repeat
with
code from trunk? Thanks!
Original comment by joe.gregorio@gmail.com
on 3 Jun 2010 at 8:19
I've downloaded trunk version.
Still got an exception with an explanation that is not self-explanatory (for me)
AttributeError: 'error' object has no attribute 'errno' (I'm pasting all
traceback
below)
I tried to debug it, with Eclipse, and the problem is here, in
httplib2.__init__():
On this line: http://is.gd/cCDHl
except socket.error, e:
if e.errno == errno.ECONNREFUSED: # Connection refused
raise
Just because e has no attribute 'errno'.
So, I wrote a raise before if statement and this was the exception
e error: (10060, 'Operation timed out')
I couldn't find where this socket exception is raised, sorry. But hope you
have, with
this, some extra data to use.
>>> h = httplib2.Http(proxy_info = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP,
'221.120.211.2', 8080))
>>> r, c = h.request("http://www.portablepython.com/")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
r, c = h.request("http://www.portablepython.com/")
File "C:\Python25\Lib\site-packages\httplib2\__init__.py", line 1135, in request
(response, content) = self._request(conn, authority, uri, request_uri, method,
body, headers, redirections, cachekey)
File "C:\Python25\Lib\site-packages\httplib2\__init__.py", line 907, in _request
(response, content) = self._conn_request(conn, request_uri, method, body,
headers)
File "C:\Python25\Lib\site-packages\httplib2\__init__.py", line 870, in
_conn_request
if e.errno == errno.ECONNREFUSED: # Connection refused
AttributeError: 'error' object has no attribute 'errno'
And this is with raise before if statement:
>>> r, c = h.request("http://www.portablepython.com/")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
r, c = h.request("http://www.portablepython.com/")
File "C:\Python25\lib\site-packages\httplib2\__init__.py", line 1136, in request
(response, content) = self._request(conn, authority, uri, request_uri, method,
body, headers, redirections, cachekey)
File "C:\Python25\lib\site-packages\httplib2\__init__.py", line 908, in _request
(response, content) = self._conn_request(conn, request_uri, method, body,
headers)
File "C:\Python25\lib\site-packages\httplib2\__init__.py", line 865, in
_conn_request
conn.request(method, request_uri, body, headers)
File "C:\Python25\lib\httplib.py", line 866, in request
self._send_request(method, url, body, headers)
File "C:\Python25\lib\httplib.py", line 889, in _send_request
self.endheaders()
File "C:\Python25\lib\httplib.py", line 860, in endheaders
self._send_output()
File "C:\Python25\lib\httplib.py", line 732, in _send_output
self.send(msg)
File "C:\Python25\lib\httplib.py", line 699, in send
self.connect()
File "C:\Python25\lib\site-packages\httplib2\__init__.py", line 752, in connect
raise socket.error, msg
error: (10060, 'Operation timed out')
>>>
Still has problems, error: (10060, 'Operation timed out')
Original comment by mati...@gmail.com
on 4 Jun 2010 at 6:19
I'm having this problem too, even with the trunk version.
I do get a "connection refused" the first time trying to access an unresponsive
server with the same Http object, but I get the AttributeError the second time:
First time:
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 1132, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 904, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 862, in _conn_request
conn.request(method, request_uri, body, headers)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 874, in request
self._send_request(method, url, body, headers)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 911, in _send_request
self.endheaders()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 868, in endheaders
self._send_output()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 740, in _send_output
self.send(msg)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 699, in send
self.connect()
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 749, in connect
raise socket.error, msg
error: [Errno 61] Connection refused
Second time:
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 1132, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 904, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/Users/nicholas/LMI/xml_proxy/lib/python2.6/site-packages/httplib2/__init__.py", line 874, in _conn_request
response = conn.getresponse()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 948, in getresponse
method=self._method)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 329, in __init__
self.fp = sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'
Original comment by nriley
on 22 Jul 2010 at 4:47
This is a bit drastic, but it works:
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -1154,6 +1154,8 @@
})
response.reason = "Bad Request"
else:
+ if 'conn' in locals():
+ del self.connections[conn_key]
raise
Original comment by nriley
on 22 Jul 2010 at 5:11
Original comment by joe.gregorio@gmail.com
on 13 Feb 2011 at 3:47
Original issue reported on code.google.com by
mati...@gmail.com
on 3 Jun 2010 at 7:27