Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
JS to Python conversion question (REST API related)

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.

Their docs for reference

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda