I can successfully do a getbalance RPC with digest authentication, e.g.:
url = "http://localhost:18082/json_rpc"
headers = {'content-type': 'application/json'}
rpc_input = {
"method": "getbalance"
}
rpc_input.update({"jsonrpc": "2.0", "id": "0"})
response = requests.post(
url,
data=json.dumps(rpc_input),
headers=headers,
auth=HTTPDigestAuth('wallet_username', 'wallet_password'))
print(response.text)
However, when I want to do a create_wallet RPC I get an Unauthorized Access HTML response:
<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>
E.g.:
url = "http://localhost:18082/json_rpc"
headers = {'content-type': 'application/json'}
rpc_input = {
"method": "create_wallet",
"params": {"filename": "mytestwallet", "password": "mytestpassword", "language": "English"}
}
rpc_input.update({"jsonrpc": "2.0", "id": "0"})
response = requests.post(
url,
data=json.dumps(rpc_input),
headers=headers,
)
print(response.text)
I do notice that the create_wallet RPC does not take a wallet username parameter, could this be my problem, or am I missing something else? (Note that at https://getmonero.org/resources/developer-guides/wallet-rpc.html#create_wallet the example does include a filename parameter but no username parameter).