tcalmant / jsonrpclib

A Python (2 & 3) JSON-RPC over HTTP that mirrors the syntax of xmlrpclib (aka jsonrpclib-pelix)
https://jsonrpclib-pelix.readthedocs.io/
Apache License 2.0
54 stars 24 forks source link

http.client.BadStatusLine error in Python3.4 when calling methods on remote server. #27

Closed tuxxy closed 6 years ago

tuxxy commented 8 years ago

Traceback (most recent call last): File "", line 1, in File "/root/redacted/venv/lib/python3.4/site-packages/jsonrpclib/jsonrpc.py", line 639, in call return self.send(self.name, args) File "/root/redacted/venv/lib/python3.4/site-packages/jsonrpclib/jsonrpc.py", line 523, in _request response = self._run_request(request) File "/root/redacted/venv/lib/python3.4/site-packages/jsonrpclib/jsonrpc.py", line 556, in _run_request verbose=self.__verbose File "/usr/lib/python3.4/xmlrpc/client.py", line 1131, in request return self.single_request(host, handler, request_body, verbose) File "/root/redacted/venv/lib/python3.4/site-packages/jsonrpclib/jsonrpc.py", line 364, in single_request response = connection.getresponse() File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse response.begin() File "/usr/lib/python3.4/http/client.py", line 351, in begin version, status, reason = self._read_status() File "/usr/lib/python3.4/http/client.py", line 333, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: {"result":[{"REDACTED REAL DATA"}],"id":"de3f4da8-3df0-4c07-8074-a9cde173b81b","jsonrpc":"2.0"}

I'm performing the call, and it does seem to be connecting to the server, performing the method, and retrieving that data I want, but it raises the BadStatusLine error.

Any info on what may be causing this?

tcalmant commented 8 years ago

Hi, Could you take a look to the response of the server using tools like Wireshark ?

The BadStatusLine exception is raised by the builtin HTTP client in the following cases:

Although, the line numbers in your stack trace doesn't match the ones on Python's repo . Maybe you should take a look into your Python installation, "/usr/lib/python3.4/http/client.py @ line 333 to check which of these conditions causes the raise of an exception.

tuxxy commented 8 years ago

It appears to be throwing the exception due to the version not starting with HTTP/. When printing version, it looks to be empty.

This works on our server with Python2.7, so we're looking at the server to see if it's sending everything properly. I'll reply with more info once I get it.

Thanks for your help!