So I currently have the functioning code in python
import requests
import json
address = "*address here*"
viewkey = "*viewkey here*"
headers = {'content-type': 'application/json'}
url = "https://api.mymonero.com:8443/get_address_txs"
data = {"address":address,"view_key":viewkey}
data = json.dumps(data)
response = requests.post(url, data=data, headers=headers)
print(response.text)
And I tried to move to nodejs to integrate it with another program I have written
var request = require('request');
var options = {
url: 'https://api.mymonero.com:8443/get_address_txs',
headers: {'content-type': 'application/json'},
data: JSON.stringify({
address:"address",
viewkey:"viewkey"
})
};
request.post(options,function(error, response, body) {
console.log(body);
})
I assumed the code would be identical but clearly not I get an error from the server with the second segment of code. Please could someone help me migrate this?
Note: I know requests in python has a json attribute I have written it in python this way for clarity.
via Joss Bird
No comments:
Post a Comment