Response(is_success=False, request_message=
I trying below code but getting error. Please see the below error and response error as well. It was working well till yesterday, But now error again.
from datetime import date
import refinitiv.data as rd
startdate=str(date.today()+timedelta(days=-10))
enddate=str((date.today())+timedelta(days=375))
rd.open_session()
url_ = "https://api.refinitiv.com/analytics/functions/v1/common/list-holidays"
body = {"universe": [{"startDate": startdate, "endDate": enddate, "calendarCodes": ["USA","UKG","IRL"]}]}
request_ = rd.delivery.endpoint_request.Definition(method=rd.delivery.endpoint_request.RequestMethod.POST,url=url_,body_parameters=body,)
response = request_.get_data()
holidays = pd.DataFrame(response.data.raw["data"][0]["holidays"])['date'].unique()
print(holidays)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[20], line 1
----> 1 holidays = pd.DataFrame(response.data.raw["data"][0]["holidays"])['date'].unique()
KeyError: 'data'
In[21]: response
Out[21]:
Response(is_success=False, request_message=<Request('POST', 'http://localhost:9060/api/rdp/analytics/functions/v1/common/list-holidays')>, http_response=<Response [403 Forbidden]>, http_headers=Headers({'access-control-allow-origin': '*', 'x-request-id': '615b825d-92d4-4cd0-976d-63d01de7ed73', 'content-type': 'text/html; charset=utf-8', 'content-length': '666', 'etag': 'W/"29a-NJjwKCOUPKrBNJgkBAgitl03pHc"', 'date': 'Wed, 27 Sep 2023 10:44:22 GMT', 'connection': 'keep-alive'}), http_status={'http_status_code': 403, 'http_reason': 'Forbidden'}, errors=[Error(code=403, message='<html>\n<head>\n<title>Forbidden</title>\n<style type="text/css">\nbody {\n background-color: #242424;\n color: #c8c7c7;\n font-family: Calibri, Helvetica, Arial, sans-serif;\n font-size: 16px;\n}\n</style>\n</head>\n<!-- Request \nReferer: https://emea1-apps.platform.refinitiv.com/Apps/data-api-proxy-csm/1.3.1/\nUser-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.4389.0.124 EikonViewer/89.4389.0.124 Safari/537.36\n-->\n<!-- Response\nServer: LO5P-ERPA08\nDate: Wed, 27 Sep 2023 10:44:22 GMT\nHTTP Code: 403\nHTTP Response: Forbidden\nX-Varnish: 59098369\nBackend: default\n-->\n<body>\n <h1>Forbidden</h1>\n <p>Invalid token</p>\n</body>\n</html>')], closure=None, requests_count=1, _data_factory=<refinitiv.data.delivery._data._response_factory.ResponseFactory object at 0x0000020F2373B370>, _kwargs={'session': <refinitiv.data.session.Definition object at 0x20f26f3a320 {name='workspace'}>, 'method': <RequestMethod.POST: 'POST'>, 'path_parameters': None, 'query_parameters': None, 'header_parameters': None, 'body_parameters': {'universe': [{'startDate': '2023-09-17', 'endDate': '2024-10-06', 'calendarCodes': ['USA', 'UKG', 'IRL']}]}}, _raw={})
Best Answer
-
Thank you for reaching out to us.
I can run the code properly.
It could be the problem in the backend because the error is:
You can enable logging in the RD library to verify what the problem is.
{
...
"logs": {
"level": "debug",
"transports": {
"console": {
"enabled": false
},
"file": {
"enabled": true,
"name": "refinitiv-data-lib.log"
}
}
},
...Please refer to the examples on GitHub regarding how to use the configuration file.
However, if it is better to contact the helpdesk support team via MyRefinitiv to verify the problem on the backend.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 162 App Studio
- 4 Block Chain
- 5 Bot Platform
- 17 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 370 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛