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