saipramod / python-rest-client

Automatically exported from code.google.com/p/python-rest-client
0 stars 0 forks source link

simple HTTPS request fails with TypeError: a float is required under Python 2.6 #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> from restful_lib import Connection
>>> conn = Connection('https://www.google.com')
>>> conn.request_get('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "restful_lib.py", line 62, in request_get
    return self.request(resource, "get", args, headers=headers)
  File "restful_lib.py", line 140, in request
    resp, content = self.h.request(u"%s://%s%s" % (self.scheme, self.host,
u'/'.join(request_path)), method.upper(), body=body, headers=headers )
  File "httplib2\__init__.py", line 1051, in request
    (response, content) = self._request(conn, authority, uri, request_uri,
method, body, headers, redirections, cachekey)
  File "httplib2\__init__.py", line 855, in _request
    (response, content) = self._conn_request(conn, request_uri, method,
body, headers)
  File "httplib2\__init__.py", line 824, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "C:\python\lib\httplib.py", line 874, in request
    self._send_request(method, url, body, headers)
  File "C:\python\lib\httplib.py", line 911, in _send_request
    self.endheaders()
  File "C:\python\lib\httplib.py", line 868, in endheaders
    self._send_output()
  File "C:\python\lib\httplib.py", line 740, in _send_output
    self.send(msg)
  File "C:\python\lib\httplib.py", line 699, in send
    self.connect()
  File "httplib2\__init__.py", line 737, in connect
    sock.settimeout(self.timeout)
  File "<string>", line 1, in settimeout
TypeError: a float is required

This is a checkout of the latest SVN trunk running on Windows Vista 64-bit
Python 2.6 64-bit.

This problem doesn't seem to happen with an HTTP request because the order
in which the httplib2.HTTPConnectionWithTimout.timeout member is set.

Original issue reported on code.google.com by jaraco%jaraco.com@gtempaccount.com on 26 May 2009 at 6:24

GoogleCodeExporter commented 9 years ago
This appears to be fixed in the trunk of httplib2.

Original comment by jaraco%jaraco.com@gtempaccount.com on 26 May 2009 at 6:42

GoogleCodeExporter commented 9 years ago
This issue belongs to httplib2 and python 2.6. It is resolved by patching 
httplib2.
See here: http://code.google.com/p/httplib2/issues/detail?id=39

Original comment by port...@gmail.com on 22 Jul 2009 at 10:50

GoogleCodeExporter commented 9 years ago
The patch worked for me. (Python 2.6.5)

Original comment by dr.chamb...@gmail.com on 11 Oct 2010 at 1:59

GoogleCodeExporter commented 9 years ago
This solution works for me in python 2.7.5. Thanks!

Original comment by euler.ji...@gmail.com on 21 Sep 2013 at 3:34