Error code 401 | token expired using forward_curves.Definition

Hi, I am running refinitiv python examples on github and can get normal data using rd.open_session(). But when I try to get curves, it fails with Error code 401 | token expired error. Could somebody help? Thanks.
response = forward_curves.Definition(
curve_definition=forward_curves.SwapZcCurveDefinition(
currency="EUR",
index_name="EURIBOR",
discounting_tenor="OIS",
main_constituent_asset_class="Swap",
),
forward_curve_definitions=[
forward_curves.ForwardCurveDefinition(
index_tenor="3M",
forward_curve_tag="ForwardTag",
forward_start_date="2021-02-01",
forward_curve_tenors=["0D", "1D"],
forward_start_tenor="some_start_tenor",
)
],
curve_parameters=forward_curves.SwapZcCurveParameters(valuation_date="2021-02-01"),
curve_tag="some_tag",
).get_data()
response.data.df
Error message:
---------------------------------------------------------------------------RDError Traceback (most recent call last)Cell In[52], line 1----> 1 response = forward_curves.Definition( 2 curve_definition=forward_curves.SwapZcCurveDefinition( 3 currency="EUR", 4 index_name="EURIBOR", 5 discounting_tenor="OIS", 6 main_constituent_asset_class="Swap", 7 ), 8 forward_curve_definitions=[ 9 forward_curves.ForwardCurveDefinition( 10 index_tenor="3M", 11 forward_curve_tag="ForwardTag", 12 forward_start_date="2021-02-01", 13 forward_curve_tenors=["0D", "1D"], 14 forward_start_tenor="some_start_tenor", 15 ) 16 ], 17 curve_parameters=forward_curves.SwapZcCurveParameters(valuation_date="2021-02-01"), 18 curve_tag="some_tag", 19 ).get_data() 21 response.data.dfFile c:\Users\LG\Desktop\test\fennics_test\.venv\lib\site-packages\refinitiv\data\content\_content_provider_layer.py:58, in ContentUsageLoggerMixin.get_data(self, session, on_response)
...
30 error = RDError(error_code, error_message) 32 error.response = response---> 33 raise errorRDError: Error code 401 | token expired
Best Answer
-
Hello @lim_443
I highly recommend you reach out to your LSEG representative to get multiple RDP accounts if you want to run multiple applications/sessions.
If you use a single RDP account with multiple sessions, the applications may encounter an error when an access token expires or when the applications attempt to refresh an access token.
Alternatively, you may set the "signon_control" in the refinitiv-data.config.json to true. This parameter overrides any previous session you logged on i.e. force sign-out this ID from other applications and sign-in here.
{
"logs": {
"level": "debug",
"transports": {
"console": {
"enabled": false
},
"file": {
"enabled": true,
"name": "refinitiv-data-lib.log"
}
}
},
"sessions": {
"default": "platform.rdp",
"platform": {
"rdp": {
"app-key": "App Key",
"username": "RDP Account",
"password": "RDP Password",
"signon_control": true
}
}
}
}0
Answers
-
What session are you using (desktop.workspace or platform.rdp)?
0 -
I am using platform.rdp. Thank you.
0 -
Thank you for the update.
First, please make sure that the RDP account is not used by other users or applications while running the application because there is only one active session for each RDP account.
For example, if the same RDP account is used by another user or application, the previous session will be invalidated and the previous application can't renew the token.
You can enable logging in the library to verify what the problem is by using the following code.
config = rd.get_config()
config.set_param("logs.transports.file.enabled", True)
config.set_param("logs.transports.file.name", "refinitiv-data-lib.log")
config.set_param("logs.level", "debug")
rd.open_session("platform.rdp")Then, please share the refinitiv-data-lib.log file when the problem occured. Please also remove the RDP credentials in the log file.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 653 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛