Python RDP Refresh token failed, response is None
Hi,
I'm using refinitiv-dataplatform 1.0.0a0 and trying to get real-time prices as a longrunning app (24/7).
But after 10 minutes I got
P[42662] [Thread-1 123145378373632] Refresh token failed, response is None
P[42662] [Thread-1 123145378373632] EDP Token Refresh failed : Refresh token request failed, response is None
I tried a trick described here with changing code in platform_session.py but nothing changed.
I also tried to add on_state and on_event but got
open_platform_session() got an unexpected keyword argument 'on_state'
How can I refresh the token for the current session?
My current code:
import refinitiv.dataplatform as rdp
import asyncio
rdp.open_platform_session(
app_key,
rdp.GrantPassword(
machine_id,
password
)
)
print('Session ', rdp.get_default_session().get_open_state())
streaming_prices = rdp.StreamingPrices(
universe=['EUR=', 'GBP=', 'JPY='],
fields=['BID', 'ASK', 'VALUE_TS1'],
on_refresh=lambda streaming_price, instrument_name, fields:
display_refreshed_fields(streaming_price, instrument_name, fields),
on_update=lambda streaming_price, instrument_name, fields:
display_updated_fields(streaming_price, instrument_name, fields),
on_status=lambda streaming_price, instrument_name, status:
display_status(streaming_price, instrument_name, status),
on_complete=lambda streaming_price:
display_complete_snapshot(streaming_price)
)
streaming_prices.open()
while True:
try:
asyncio.get_event_loop().run_until_complete(asyncio.sleep(1))
except (KeyboardInterrupt, SystemExit):
rdp.close_session()
break
Best Answer
-
I did a quick test with python3.6 and found a similar error but unable to see when running with 3.7.
Can you try the codes with Python 3.7 or 3.8?
I suspect that it might be the same issue mentioned in this post. It seems to be a problem with the conflict version of asycio lib but I can't confirm.0
Answers
-
Hello @Alena.Melnikova
What is the environment (Jupyter Notebook or Console) and Python version that you are using?
I am testing your code with Python 3.7.7 in Jupyter Notebook for an hour but I cannot replicate the issue in my environment yet.
0 -
I also tried your codes on Jupyter notebook but still not see issues as well. I can run for more than 1-2 hours. Note that I just print the fields out.
Do you have any chance to try your account with another example and did you found the token issue?
I'm not sure that is there any exception when you parse the field data so it interrupts the whole process?
0 -
Hi @moragodkrit.chumsri_1 and @wasin.w
Thanks for your responses!
I run in PyCharm with Python 3.6.8.
I also tried an example with rdp.ItemStream:
item_stream = rdp.ItemStream(
session=session,
domain='MarketByPrice',
name="BB.TO",
on_refresh=lambda item_stream, event: display_event("Refresh", event),
on_update=lambda item_stream, event: display_event("Update", event),
on_status=lambda item_stream, event: display_event("Status", event),
on_complete=lambda item_stream: display_event("Complete", "")
)
item_stream.open()
while True:
try:
asyncio.get_event_loop().run_until_complete(asyncio.sleep(1))
except (KeyboardInterrupt, SystemExit):
rdp.close_session()
breakand get the same issue in 9 minutes after start script:
>>> Status event received at 18:54:01.305752
{'status': <StreamState.Open: 3>, 'code': 'Open', 'message': '*All is well'}
...
>>> Update event received at 19:01:09.665777
{'ID': 1, 'Type': 'Update', 'Domain': 'MarketByPrice', 'UpdateType': 'Unspecified', 'Key': {'Service': 'ELEKTRON_DD', 'Name': 'BB.TO'}, 'SeqNumber': 61888, 'Map': {'KeyType': 'Buffer', 'Summary': {'Fields': {'TIMACT_MS': 39669358}}, 'Entries': [{'Action': 'Update', 'Key': 'NS45NTAwMDBC', 'Fields': {'ORDER_PRC': 5.95, 'ORDER_SIDE': 'BID', 'ACC_SIZE': 200, 'NO_ORD': 2, 'LV_TIM_MS': 39669358, 'LV_TIM_MSP': 80, 'LV_DATE': '2020-08-06'}}]}}
2020-08-06 19:02:57,172 P[47654] [Thread-1 123145384079360] Refresh token failed, response is None
2020-08-06 19:02:57,174 P[47654] [Thread-1 123145384079360] EDP Token Refresh failed : Refresh token request failed, response is None
2020-08-06 19:12:01,878 P[47654] [Thread-1 123145384079360] Refresh token failed, response is None
2020-08-06 19:12:01,881 P[47654] [Thread-1 123145384079360] EDP Token Refresh failed : Refresh token request failed, response is None
2020-08-06 19:21:06,236 P[47654] [Thread-1 123145384079360] Refresh token failed, response is None
2020-08-06 19:21:06,237 P[47654] [Thread-1 123145384079360] EDP Token Refresh failed : Refresh token request failed, response is NoneThere is nothing special in parsing data. Just print it:
def display_event(eventType, event):
currentTime = datetime.datetime.now().time()
print("----------------------------------------------------------")
print(">>> {} event received at {}".format(eventType, currentTime))
print(event)
returnCan it be a problem with my account? I use a machine account.
0 -
@moragodkrit.chumsri_1 You're right! I tried Python 3.7 and it works without intervention 3 hours already! Thank you!
I also noticed that I can't run one more app in parallel. In a few minutes, the first app failed with error
[Error 400 - access_denied] iPlanet session has been expired.
Even if I use different app_key. Does it mean I can't run a few apps for one account?
0 -
Hello @Alena.Melnikova
Please be inform that the platform allow one machine-id login at a time only , so you cannot use the same machine-id to connects to ERT in Cloud simultaneously (even using different app_key/client_id).
0 -
sure, I made it public
0 -
got it! Thank you!
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
- 617 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
- 276 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
- 654 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
- 91 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛