http json-rpc error connect to wallet
Opened this issue · 0 comments
SuperCipher commented
bchwallet --version
bchwallet version 0.9.0
bchd --version
bchd version 0.16.3
bchwallet --simnet --noclienttls --noservertls --username admin --password adminpass —rpcconnect localhost:18556
I'm trying to connect to bchwallet through python http post
import getpass
import json
import requests
from requests.auth import HTTPBasicAuth
# python json rpc
# bchd
# URL = "http://127.0.0.1:18556/"
# bchwallet
URL = "http://127.0.0.1:18554/"
def instruct_wallet(method, params):
payload = json.dumps({"jsonrpc":"1.0","id":"0","method": method, "params": params})
headers = {'content-type': "application/json", 'cache-control': "no-cache"}
try:
response = requests.request("POST", URL, data=payload, headers=headers, auth=HTTPBasicAuth(rpc_user, rpc_password))
print( json.loads(response.text))
except requests.exceptions.RequestException as e:
print (e)
except:
print(response)
# print ('No response from Wallet, check Bitcoin is running on this machine')
rpc_user='admin'
rpc_password='adminpass'
# instruct_wallet('getinfo', [])
instruct_wallet('getbalance', [])