Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 Unauthorized #104

Open
iamdiwang opened this issue Sep 29, 2021 · 1 comment
Open

401 Unauthorized #104

iamdiwang opened this issue Sep 29, 2021 · 1 comment

Comments

@iamdiwang
Copy link

File "censored", line 197, in _get_response
raise JSONRPCException({
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server

@krewshul
Copy link

krewshul commented Oct 3, 2021

File "censored", line 197, in _get_response raise JSONRPCException({ bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '401 Unauthorized' from server

it looks like the daemon or wallet you are trying to connect to is not recognizing you.

please check the "~/.bitcoin/bitcoin.conf " and confirm you are using the correct values for "rpcuser", "rpcpassword", "rpcport"

also if you are attempting to connect to a wallet that is not on your localhost, make sure that the value for "rpcallowip" in your"~/.bitcoin/bitcoin.conf " is the same as the ip address that you are making the call from

example

*your_script.py

rpc_user="YOURUSERNAME"
rpc_password="YOURPASSWORD"
rpc_port="RPCPORT"
import logging
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
rpc_conn = AuthServiceProxy("http://%s:%[email protected]:%s"%(rpc_user, rpc_password, rpc_port))
wallet_info = rpc_conn.getinfo()

*your coindaemon.conf (ex: bitcoin.conf, litecoin.conf, dogecoin.conf)

rpcuser="YOURUSERNAME"
rpcpassword="YOURPASSWORD"
server=1
daemon=1
listen=1
rpcallowip=127.0.0.1 (if the daemon is on the same computer that you are making the call from, leave this as "127.0.0.1")
rpcallowip="IP OF_THE_PC_USING_THE_SCRIPT" (if the daemon is on a different computer that you are making the call from, change to the ip of the computer making the call.)
rpcport="RPCPORT"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants