我在连接比特币和门罗币的 RPC 服务器时遇到问题。我正在使用 python-bitcoinrpc 和 python-monerorpc 作为库,但它们无法同时连接。这是我正在使用的代码:
from monerorpc.authproxy import AuthServiceProxy, JSONRPCException
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
arg = {
"destinations":
[{
"amount": 499978865000,
"address": "A2Xt28bHwF7TaqERoUV4QMTKkpytNMLVRaKGHnasdeNz6WEEWZ6K9LHZFXgNbQhskC24ejuMxfWzpNBG56EecXhdFqPG3GK",
}],
"account_index": 0,
"priority": 0,
"get_tx_key": True,
}
btc = AuthServiceProxy(service_url="http://<username>:<password>@server-ip:port", timeout=120)
xmr = AuthServiceProxy(service_url='http://<username>:<password>@server-ip:port/json_rpc')
print(xmr.getnewaddress("", "p2sh-segwit"))
print(xmr.getbalance())
连接时出现此错误:
-342: non-JSON HTTP response with '401 Unauthorized' from server
任何帮助将不胜感激!