I have someone who can help me get closer to my goals.
my code
# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user = "umbrel"
rpc_pass = "pass"
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)
We need to print the BlockHeight of the node. But it shows 403 – Forbidden.
error message
Traceback (most recent call last):
File "/media/donbolli/code/python/bitcoin/crawler/test.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
raise JSONRPCException({
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '403 Forbidden' from server