I am trying to get Open Interest data for a futures instrument.
This is the request part of the code that I am using -
requestUrl='https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw'
requestHeaders={
"Prefer":"respond-async",
"Content-Type":"application/json",
"Authorization": "token " + token
}
requestBody={
"ExtractionRequest": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryIntradaySummariesExtractionRequest",
"ContentFieldNames": [
"Open Interest"
],
"IdentifierList": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [{
"Identifier": "GCJ8",
"IdentifierType": "Ric"
}],
"UseUserPreferencesForValidationOptions":"false"
},
"Condition": {
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": "2016-09-29T00:00:00.000Z",
"QueryEndDate": "2016-09-30T00:00:00.000Z",
"SummaryInterval": "OneHour",
"TimebarPersistence":"true",
"DisplaySourceRIC":"true"
}
}
}
r2 = requests.post(requestUrl, json=requestBody,headers=requestHeaders)
#Display the HTTP status of the response
#Initial response status (after approximately 30 seconds wait) is usually 202
print ("HTTP status of the response: " + str(r2.status_code))
#Display the location url we received and will use to get the status of the extraction request
print (r2.headers["location"])
Now I am getting an error in the last line (ie in r2.headers["location"])-
KeyError: 'location'
I need to know what I might be sending wrong?
Is it the requestUrl (requestUrl='https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw') OR
Is it the "@odata.type" in "ExtractionRequest" part of the code ("#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryIntradaySummariesExtractionRequest")
OR
something else?