Javascript from docs
const body = {
name: "<replace with your credentials>",
password: "<replace with your credentials>",
appId: "Sample App",
appVersion: "1.0",
cid: 8,
sec: "f03741b6-f634-48d6-9308-c8fb871150c2",
deviceId: "123e4567-e89b-12d3-a456-426614174000"
}
const response = await fetch('https://live.tradovateapi.com/v1/auth/accesstokenrequest', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify(body)
})
Sorry for the crudeness of this question. I understand Javascript like i understand Sumerian. What would the python equivalent of this be?
My attempt (in python):
@bot.command(pass_context=True)
async def tradoMarket(symbol, side):
url = 'https://demo.tradovateapi.com/order/placeorder'
#url = 'https://live.tradovateapi.com/order/placeorder'
headers = {
"Content-Type": 'application/json',
"Accept": 'application/json'
}
data = {
"name": 'xxxxxx',
"password": 'xxxxxx',
"appId": 'xxxxxx',
"appVersion": '1.0',
"cid": xxxxxx,
"sec": 'xxxxxx-xxxxxx-xxxxxx'
}
data_json = json.dumps(data)
response = requests.post('https://demo.tradovateapi.com/v1/auth/accessTokenRequest', headers=headers, data=data_json)
print(response.json())
I do get a response from their API. It was essentially wrong UN/PW, but Im 100% sending the correct information which is telling me my formatting is wrong.