Unable to connect to Refinitiv using refinitiv-data module

Hello, I am using following code to connect to Refinitiv using refinitiv-data module. However, I am getting error while connecting.

Code Snippet:

import refinitiv.data as rd

rd.session.platform.Definition(
app_key = '9505**********************',
grant = rd.session.platform.GrantPassword(
username = 'lisa*****',
password = '********'
)
).get_session()

rd.open_session()

df = rd.get_data(
universe=['IBM.N', 'VOD.L'],
fields=['BID', 'ASK', 'TR.Revenue']
)
print(df)

Error:

An error occurred while requesting URL('http://localhost:9000/api/status').

ConnectError('[WinError 10061] No connection could be made because the target machine actively refused it')

An error occurred while requesting URL('http://localhost:9060/api/status').

ConnectError('[WinError 10061] No connection could be made because the target machine actively refused it')

Error: no proxy address identified.

Check if Desktop is running.

An error occurred while requesting URL('http://localhost:9000/api/handshake').

ConnectError('[WinError 10061] No connection could be made because the target machine actively refused it')


Please can you point out what is going wrong.


Thanks

Best Answer

  • @lisa.mcentee

    Sorry about the issue that you are facing.

    According to the provided code, you would like to use the platform session to connect the Refinitiv Data Platform API. However, the error indicates that you are connecting to the desktop session.

    To create a Platform session using an App Key and GrantPassword, the code looks like this:

    session = rd.session.platform.Definition(
        app_key = APP_KEY, 
        grant = rd.session.platform.GrantPassword(
            username = RDP_LOGIN, 
            password = RDP_PASSWORD
        )
    ).get_session()

    session.open()

    rd.session.set_default(session)

    After that, you can call the rd.get_data method to retrieve the data.

    I hope that this information is of help