Hello All,
I trying to retrieve an end of day request using python.
urlGetToken = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken'
header1 = {'Content-Type': 'application/json'}
tokenRequestBody = json.dumps({'Credentials':{'Password':psswd,'Username':username}})
print('Request String: ' + tokenRequestBody)
response = requests.post(urlGetToken, tokenRequestBody, headers=header1)
token = response.json()['value']
header3 = {'Content-Type': 'application/json', 'Authorization': 'Token ' + token, 'Prefer': 'respond-async, wait=5'}
data = json.dumps({
"ExtractionRequest": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.EndOfDayPricingExtractionRequest",
"ContentFieldNames": [
"RIC",
"Ticker",
"Universal Ask Price",
"Universal Bid Ask Date",
"Universal Bid Price",
"Universal Close Price",
"Volume",
],
"IdentifierList": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{
"Identifier": "Cc1",
"IdentifierType": "Ric"
}]
},
"Condition": None
}
})
url = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/Extract'
resp = requests.post(url, data, headers=header3)
After I run the above code.
I get a 202 response and I an unable to use the location url from the header to retrieve the data.
Does anyone have an example to Get End of Day data, subsequent request after a timeout - HTTP request using python and the request module. I am using python3.6