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).
create_wallet
and notcreate wallet
without the underscore as per the docs (getmonero.org/resources/developer-guides/…) - I have fixed this in my question. When I run this second part (withcreate_wallet
) and the wallet with--disable-rpc-login
then the wallet creation succeeds. So I guess my question really becomes, how do I authenticate with HTTPDigestAuth when I don't yet have awallet_username
orwallet_password
? I mean, I am creating the wallet withcreate_wallet
, so it wouldn't have these credentials yet.