Hi everyone,
I am trying to download analyst reports using the Eikon Data API in Python, but I am running into issues with both approaches I have tried. Hoping someone here can help!
Issue 1: 500 Internal Server Error for Document Download
The first method I tried was getting the document ID and then using the /documents/download/{documentId}
endpoint to download it. However, when I try to connect this endpoint, I get a 500 Internal Server error. Did I use the wrong parameters in this downloading request? Should I add a path parameter when sending the request? Or does this mean the endpoint is not available? Here is the code I used:
import refinitiv.dataplatform as rdp
import pandas as pd
rdp.open_platform_session(
Eikon_Data_API_KEY,
rdp.GrantPassword(
username=my_username,
password=my_password)
)
UUID = my_UUID
endpoint_document_download = rdp.Endpoint(
session=rdp.get_default_session(),
url='https://api.refinitiv.com/data/hvmi/v1/documents/download/113543190',
)
response_document_download = endpoint_document_download.send_request(
method=rdp.Endpoint.RequestMethod.GET,
)
print(response_document_download.is_success)
print(pd.DataFrame(response_bulk.data.raw))
Issue 2: 403 Forbidden for Bulk Request
The second method I tried was following a forum demo—first submitting a bulk request, then manifesting the files, and finally downloading them. However, I am stuck at the first step because when I try to submit a bulk request, I get a 403 Forbidden error. The error message shows 'access denied. Scopes required to access the resource: [trapi.data.research.read]. Missing scopes: [trapi.data.research.read]'. Does this mean I do not have access to this endpoint? I can access other endpoints just fine.
Here is the code I used for the bulk request:
import refinitiv.dataplatform as rdp
import pandas as pd
rdp.open_platform_session(
Eikon_Data_API_KEY,
rdp.GrantPassword(
username=my_username,
password=my_password)
)
UUID = my_UUID
endpoint_bulk = rdp.Endpoint(
session=rdp.get_default_session(),
url='https://api.refinitiv.com/data/research/v1/bulk-request',
)
response_bulk = endpoint_bulk.send_request(
method=rdp.Endpoint.RequestMethod.POST,
body_parameters={
"action": "RUN",
"clientUUID": my_UUID,
"jobName": "ZheshangBulk",
"contributors": [
{
"ctbName": "Zheshang Securities Co., Ltd.",
"ctbId": 36351,
"docType": [
"TEXTLINEBREAK",
"TEXTPARAGRAPHBREAK"
],
"dateRange": {
"from": "2011-01-01T00:00:00Z",
"to": "2021-01-01T00:00:00Z"
}
}
],
"notification": {
"jobStart": True,
"jobEnd": True,
"emails": [
my_email
]
}
}
)
print(response_bulk.is_success)
print(pd.DataFrame(response_bulk.data.raw))
Has anyone encountered similar issues? Any insights on whether these endpoints require special permissions or if there is another way to get analyst reports?
Thanks in advance!