POST /session Token 500 Internal Server Error

python, windows, rest api

screenshot-2023-01-26-125223.png


How do I bypass this error?

Best Answer

  • gteage
    Answer ✓

    @mcopeland Hi, please could you try the below, replacing the <Your password> with your password this should obtain a 200 OK then the Token is found in the "value" key in the response:

    import requests

    url = "https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken&quot;

    payload = "{\r\n \"Credentials\": {\r\n \"Username\": \"9033378\",\r\n \"Password\": \"<Your password>\"\r\n }\r\n}"
    headers = {
    'Prefer': 'respond-async',
    'Content-Type': 'application/json; odata=minimalmetadata'
    }

    r = requests.request("POST", url, headers=headers, data=payload

    print ('POST /session Token', r.status_code, r.reason)