Registry / http-networking / python-bitcoinrpc

python-bitcoinrpc

JSON →
library1.0pypypi✓ verified 86d ago

Enhanced version of python-jsonrpc for use with Bitcoin. This library provides a simple RPC client to interact with Bitcoin Core's JSON-RPC API. Current version is 1.0, but the project is in maintenance mode and has known issues with modern Python and Bitcoin Core versions.

pip install python-bitcoinrpc
INSTALL
IMPORT
SIG · PYTHON-BITCOINRPC
P
python-bitcoinrpc
http-networkingpythonv1.0
Install
2.4s avg
Import
89ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.092s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.086s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthServiceProxy
from bitcoinrpc.authproxy import AuthServiceProxy
from bitcoinrpc import AuthServiceProxy
import from bitcoinrpc.authproxy directly, not from bitcoinrpc top-level
JSONRPCException
from bitcoinrpc.authproxy import JSONRPCException
from bitcoinrpc.exceptions import JSONRPCException
JSONRPCException is defined in authproxy module, not in exceptions

Connect to a Bitcoin Core RPC server using environment variables for credentials.

from bitcoinrpc.authproxy import AuthServiceProxy rpc_user = os.environ.get('RPC_USER', 'user') rpc_password = os.environ.get('RPC_PASSWORD', 'pass') rpc_host = os.environ.get('RPC_HOST', '127.0.0.1') rpc_port = os.environ.get('RPC_PORT', '8332') # Note: python-bitcoinrpc expects URL with credentials embedded url = f'http://{rpc_user}:{rpc_password}@{rpc_host}:{rpc_port}' proxy = AuthServiceProxy(url) # Test connection print(proxy.getblockchaininfo())
Debug
Known issues
breakingThe library expects the RPC URL to contain the username and password directly in the URL (e.g., http://user:pass@host:port). Using a pre-authenticated URL or passing separate credentials to AuthServiceProxy is not supported.
fix
Construct the URL as 'http://{rpc_user}:{rpc_password}@{rpc_host}:{rpc_port}'
affects: all
deprecatedpython-bitcoinrpc is largely unmaintained and does not support Python 3.7+. It uses deprecated 'cookielib' and other Python 2 idioms. Consider using 'bitcoinrpc' (Python 3 fork) or direct requests to call JSON-RPC.
fix
Switch to the maintained fork 'python-bitcoinrpc' (different package) or use requests library directly.
affects: >=1.0
gotchaThe library does not support SSL/TLS by default. Connecting over plain HTTP may expose credentials. Use a local RPC connection or tunnel if needed.
fix
Ensure RPC server is on localhost or use a reverse proxy with HTTPS.
affects: all
Errors
Common errors & fixes
ImportError: No module named bitcoinrpc.authproxy
The package is not installed or installed in wrong environment.
fix
Run 'pip install python-bitcoinrpc' and verify import path: from bitcoinrpc.authproxy import AuthServiceProxy
AttributeError: 'NoneType' object has no attribute 'group'
The library's regex parsing of the RPC response failed, often due to malformed response or unexpected characters.
fix
Ensure the RPC server returns valid JSON. Check that the URL is correct and the server is running.
Error: unable to connect to RPC server
The RPC URL is incorrect or server is not reachable.
fix
Verify RPC_HOST, RPC_PORT, and credentials. Test with curl: curl --user user:pass --data-binary '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' http://127.0.0.1:8332
Upgrade
Version history
1.0latest on PyPI · released Aug 24, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Resources
python-bitcoinrpc — pip install python-bitcoinrpc · libregistry