0

Starting to interface with my btc node and I'm getting an RPC error 401 unoathorized error when running the below code. My RPC_Auth (rpcuser:rpcpassword) is correct. Is there something else I need to configure? Any help would be appreciated.

rpc_url = f"http://{rpc_auth}@{rpc_host}:{rpc_port}"
rpc_client = AuthServiceProxy(rpc_url, timeout=120)

try:

peer_info = rpc_client.getpeerinfo()
print(peer_info)

except JSONRPCException as e: print(f"RPC Error: {e}")

chump365
  • 41
  • 4
  • When you set rpcuser and rpcpassword in your bitcoin.conf, did you also restart Bitcoin Core so that those changes apply? – Ava Chow Sep 07 '23 at 20:53
  • I set rpcauth using the rpcauth.py file during my IBD so that hasnt changed. – chump365 Sep 08 '23 at 02:50
  • https://bitcoin.stackexchange.com/questions/46782/rpc-cookie-authentication helped answer all my questions and get this figured out. – chump365 Sep 08 '23 at 19:12

0 Answers0