Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Refinitiv Data Platform /
  • Refinitiv Data Platform Libraries /
avatar image
REFINITIV
Question by Alena.Melnikova · Aug 06, 2020 at 04:16 AM · rdp-apirefinitiv-data-platformrefinitiv-data-platform-libraries

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


People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

5 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by moragodkrit.chumsri_1 · Aug 07, 2020 at 04:31 AM

@Alena.Melnikova

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.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by wasin.w · Aug 06, 2020 at 10:06 AM

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.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by moragodkrit.chumsri_1 · Aug 06, 2020 at 10:22 AM

@Alena.Melnikova

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?

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Alena.Melnikova · Aug 06, 2020 at 11:28 AM

Hi @moragodkrit and @Wasin Waeosri

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()
        break

and 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 None

There 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)
    return

Can it be a problem with my account? I use a machine account.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Alena.Melnikova · Aug 07, 2020 at 07:47 AM

@moragodkrit 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?

Comment

People who like this

0 Show 2 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
wasin.w ♦♦ · Aug 07, 2020 at 08:12 AM 0
Share

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).

avatar image
REFINITIV
Alena.Melnikova wasin.w ♦♦ · Aug 07, 2020 at 08:53 AM 0
Share

got it! Thank you!

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
7 People are following this question.

Related Questions

Where can I find the source code for Refinitiv.DataPlatform .NET?

how to enable RTSP,SMTP,and RTMP protocols in curl

I signed up on this platform to access live stock market data but can't get the API access credentials to use the .NET library. I keep getting the 401 error page even for the quickstart page (details below). Is it a general problem or is it just for me?

Retrieve ESG Summary, ESG Performance commentary using RDP

AttributeError: 'DataFrame' object has no attribute 'convert_dtypes'

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges