Monday, June 24, 2024
HomeBitcoinpython - RPC to Umbrel returns 403

python – RPC to Umbrel returns 403


I’ve mangad to get nearer to my aim.

My Code

# rpc_user and rpc_password are set within the bitcoin.conf file
rpc_user = "umbrel"
rpc_pass = "go"
rpc_host = "192.168.1.122"
rpc_port = "8332"
rpc_connection = f"http://{rpc_user}:{rpc_pass}@{rpc_host}:{rpc_port}"
rpc_client = AuthServiceProxy(rpc_connection, timeout=240)
num_blocks = rpc_client.getblockcount()
print(num_blocks)

Which ought to simply print out the BlockHeight of the node. However I get a 403 – Forbidden

Error Message

Traceback (most up-to-date name final):
  File "/media/donbolli/code/python/bitcoin/crawler/check.py", line 37, in <module>
    num_blocks = rpc_client.getblockcount()
  File "/media/donbolli/code/python/bitcoin/venv/lib/python3.10/site-packages/bitcoinrpc/authproxy.py", line 139, in __call__
    response = self._get_response()
  File "/media/donbolli/code/python/bitcoin/venv/lib/python3.10/site-packages/bitcoinrpc/authproxy.py", line 186, in _get_response
    elevate JSONRPCException({
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '403 Forbidden' from server

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments