I can't connect to RPC from python. JSONRPCException: -342

2

Tryed to run this code :

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import logging
import json

logging.basicConfig()
logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)

rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:18332"%('user', 'password'))
print(rpc_connection.getinfo())

with my pass and my username but I have this error:

DEBUG:BitcoinRPC:-1-> getinfo [] Traceback (most recent call last): File "/home/conio/Scrivania/conioclass/conio/components/provaRPC.py", line 9, in <module> print(rpc_connection.getinfo()) File "/home/conio/Scrivania/conioclass/conio/components/bitcoinrpc/authproxy.py", line 139, in __call__ response = self._get_response() File "/home/conio/Scrivania/conioclass/conio/components/bitcoinrpc/authproxy.py", line 187, in _get_response 'code': -342, 'message': 'non-JSON HTTP response with \'%i %s\' from server' % (http_response.status, http_response.reason)}) bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server

Can you help me?

Antony Zappacosta

Posted 2016-08-23T12:28:24.400

Reputation: 41

Fixed... there were some problems in the bitcoin.conf fileAntony Zappacosta 2016-08-23T12:44:46.120

No answers