Hi Team, please can you answer the below questions from my client.
I have a couple of questions on the recommended Python package and required credentials please.
There are three Python packages available:
https://pypi.org/project/refinitiv-data/
https://pypi.org/project/refinitiv-dataplatform/
https://pypi.org/project/lseg-data/
Which one do you recommend to use?
And then given the recommended package, could you share some example code that initiates a session without need for a config file please?
For example, using the definitiv.dataplatform I have tried:
import refinitiv.dataplatform as rdp
grant = rdp.GrantPassword(username="
cip@vitol.com
", password=xyz)
rdp.open_platform_session(
app_key="as generated on the workspace app",
grant=grant,
)
But this give me a PlatformSessionError:
PlatformSessionError: Error code -1 | ERROR!!! response 400 while requesting URL('https://api.refinitiv.com/auth/oauth2/v1/token').
{"error":"access_denied" ,"error_description":"Invalid username or password." }
I have also tried refinitiv.data but this seems more involved:
import refinitiv.data as rd
grant = rd.session.platform.GrantPassword(username="
cip@vitol.com
", password=…)
definition = rd.session.platform.Definition(
app_key="another api key",
grant=grant,
signon_control=False)
session = definition.get_session()
rd.open_session()
df = rd.get_data(
universe=['USD=', 'EUR=', "LSEG.L"],
fields=['BID', 'ASK', 'TR.Revenue']
)
Thank you for looking into this.
Kind regards,
Denis