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 Ativut.Trikalsaransukh · Jun 24, 2020 at 07:55 AM · pythonrdp-apirefinitiv-data-platformrefinitiv-data-platform-libraries

Cannot retrieve ESG data via RDP libraries in Python

I am using RDP libraries to retrieve ESG data via the delivery layer as per the tutorial written here:

https://developers.refinitiv.com/article/discover-our-upcoming-refinitiv-data-platform-library-part-2-0


However, when I try it with my code, it says:

EndpointError: Error code -1 | Session is not opened. Can't send any request


Not really sure why. Here is my code below (I removed my real RDP login and pwd for security purpose):

import refinitiv.dataplatform as rdp

APP_KEY = 'DEFAULT_CODE_BOOK_APP_KEY'
RDP_LOGIN = '<MY LOGIN HERE>'
RDP_PASSWORD = '<MY PWD HERE>'

session = rdp.PlatformSession(
    APP_KEY,
    rdp.GrantPassword(username=RDP_LOGIN, password=RDP_PASSWORD)
)

endpoint_url = 'data/environmental-social-governance/v1/views/scores-full'
endpoint = rdp.Endpoint(session, endpoint_url)
response = endpoint.send_request(method=rdp.Endpoint.RequestMethod.GET, query_parameters={'universe': 'ADVANC.BK'})

My environment is in Codebook.

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.

4 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by umer.nalla · Jun 24, 2020 at 08:12 AM

Hi @Ativut.Trikalsaransukh

Are you doing the above in CodeBook or your own offline Jupyter or .py file?

Just checking because you have the Codebook APP Key - but then you are trying to open a PlatformSession?

Since codebook is part of Eikon, you should be using a desktop session (i.e. an Eikon/Workspace Session) as explained.

session = rdp.open_desktop_session('DEFAULT_CODE_BOOK_APP_KEY')

However, once you do that and make the request it would appear that the Codebook is not permissioned yet to consume ESG data.

If I print the raw response data:

print(response.data.raw)

I get the following:

{'error': {'id': '2d2199a1-6fca-4ac4-a6e6-dd3fcc6655aa', 'code': 'insufficient_scope', 'message': 'access denied. Scopes required to access the resource [trapi.data.esg.views-scores-full.read]', 'status': 'Forbidden'}}

So, for now - if you want to consume ESG data, I suspect you will need to install Python locally and execute the code locally with a PlatformSession - assuming you MachineID is licensed for ESG data.

If however, you are running locally, then it could be that your session fails because you don't have a valid AppKey?

Once you confirm where/how you are running your script, I will reach out to the Codebook owner to comment if appropriate.

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 pimchaya.wongrukun01 · Jun 24, 2020 at 08:22 AM

Hello @Ativut.Trikalsaransukh

I can replicate the problem using the given source code.

When I change from rdp.PlatformSession(..) to be rdp.open_platform_session(..) then I can get ESG data:

My source code:

session = rdp.open_platform_session(
    APP_KEY,
    rdp.GrantPassword(username=RDP_USER, password=RDP_PASSWORD)
)
endpoint_url = 'data/environmental-social-governance/v1/views/scores-full'
endpoint = rdp.Endpoint(session, endpoint_url)
response = endpoint.send_request(method=rdp.Endpoint.RequestMethod.GET, query_parameters={'universe': 'ADVANC.BK'})
result = response.data.raw
result

result:

Note: I run the source code above in Jupyter notebook.


result.png (20.7 KiB)
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 Ativut.Trikalsaransukh · Jun 24, 2020 at 08:49 AM

Hello @Umer Nalla and @Pimchaya.Wongrukun

Thank you both for your insights. To clarify Umer's doubt, I am doing this in Codebook.


I guess I am just confused with the difference between DesktopSession / PlatformSession and open_desktop_session / open_platform_session. In the document, it says that the first should be used in Content Layer and the latter should be used in Function Layer. So is it safe to assume that for data that is currently only available in Delivery Layer, the "open" one should be used?


Next is the Codebook environment, based on Umer's info, is it safe to summarize that:

1) Codebook is not ready to retrieve ESG data yet.

2) Once it's ready, open_desktop_session should be used so I should not have to supply my RDP credential


And lastly on local Jupyter environment:

I tried just a moment ago and it does work indeed. I have to replace my APP_KEY to my own and as Pimchaya mentioned, I will need to use open_platform_session function

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 umer.nalla · Jun 24, 2020 at 09:23 AM

Hi @Ativut.Trikalsaransukh

Your welcome.

For clarification of Session type, please refer to part 1 of my article - where I explain the difference between the session types - Dekstop(Eikon/WorkSpace), Platform(Cloud) and Deployed(ADS).

Just to complicate matters slightly, in the future versions of RDP library both Cloud and ADS will be classed as Platform Session (the format of the call will be different).

The session type is independent of the Library layer i.e. Function, Content or Delivery - which reflect different levels of ease of use etc.

At present, you need to use the Delivery layer for ESG data - but in the new version of the RDP library(not generally available yet), there is Function layer support for ESG - thereby making it easier - no need to create Endpoints etc:

df = rdp.get_esg_standard_scores(universe = '6758.T') 

But as mentioned this is not available just yet.

Finally, would you be OK if we remove the Internal status of this post, as I think the content will be helpful to customers once they start trialling CodeBook?

Thanks.

Comment

People who like this

0 Show 1 · 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
Ativut.Trikalsaransukh · Jun 24, 2020 at 11:05 AM 0
Share

Thank you. Sure I will remove the internal flag on this.

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 >
9 People are following this question.

Related Questions

Python RDP StreamingPrices returns no data

RDP in Python not connecting despite valid App Key

Refinitiv Data Platform library version on pip vs EIKON codebook

WebSocket error occurred for web socket client. Connection is already closed.

RDP Python API performance

  • 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
  • FX Venues
    • FX Trading – RFQ Maker
  • 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
  • Yield Book Analytics
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges