question

Upvotes
18 0 0 2

Problem with refinitiv-data.config.json for refinitiv-data library

I have made changes to refinitiv-data.config.json file, but it seems they are not taken over. How to test whether the config is proper considered.

Project structure:

1714725292672.png

My config file is as follows:

{

"sessions": {

"default":"platform.rdp",

"platform": {

"rdp": {

"app-key": "xxx",

"username": "xxx",

"password": "xxx"

}

}

},

"apis": {

"data": {

"datagrid": {

"underlying-platform": "udf"

}

}

}

}

and I am trying to open a session:

import os

os.environ["RD_LIB_CONFIG_PATH"] = "./Configuration"

import refinitiv.data as rd

from refinitiv.data.content import fundamental_and_reference

import datetime

rd.open_session() -> error here:

[Error 401] - {'error': 'invalid_client', 'error_description': 'Invalid Application Credential.'}

<refinitiv.data.session.Definition object at 0x1d196f09e50 {name='rdp'}>

When I use the same credentials directly with :

session = rd.session.platform.Definition(

app_key='xxx',

grant=rd.session.platform.GrantPassword(

username= "xxx",

password="xxx"

)

).get_session()

session.open()

rd.session.set_default(session) -> I get my session opened and I also get data from

response = fundamental_and_reference.Definition(

["TRI.N", "IBM.N"],

["TR.Revenue", "TR.GrossProfit"]

).get_data()

response.data.df

I want to use config file as I am testing the differences in outputs between UDF Datagrid and RDP Datagrid

#technology#productrefinitiv-data-libraries
1714725292672.png (14.9 KiB)
icon clock
10 |1500

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

Upvotes
80.1k 257 52 75

@Anastasiia.Shcherbak

Thank you for reaching out to us.

For readability, the code and configurations should be posted in the code block.

1714730502346.png

I have tested the configuration and it worked fine.

You may need to enable logging in the library to verify what the problem is by using the following code.

config = rd.get_config()
config.set_param("logs.transports.file.enabled", True)
config.set_param("logs.transports.file.name", "refinitiv-data-lib.log")
config.set_param("logs.level", "debug")
rd.open_session()

Then, the refinitiv-data-lib.log file will be created. Please share this log file.

I found the following message in the log file.

[2024-05-03T17:00:33.267845+07:00] - [sessions.platform.rdp.0] - [DEBUG] - [109384 - MainThread] - [_definition] - [_update_content_type] - UDF DataGrid service cannot be used with platform sessions, RDP DataGrid will be used instead. The "/apis/data/datagrid/underlying-platform = 'udf'" parameter will be discarded, meaning that the regular RDP DataGrid service will be used for Fundamental and Reference data requests.

This indicates that the platform.rdp session doesn't support UDF DataGrid.


1714730502346.png (5.0 KiB)
icon clock
10 |1500

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

Upvotes
18 0 0 2

I am getting the following log:

[2024-05-03T12:51:11.215357+02:00] - [sessions.platform.rdp.17] - [DEBUG] - [8728 - MainThread] - [_platform_session] - [_connection] - Created session connection SessionCxnType.REFINITIV_DATA
[2024-05-03T12:51:11.217347+02:00] - [sessions.platform.rdp.17] - [DEBUG] - [8728 - MainThread] - [_session_provider] - [session_provider] -  + Session created: PlatformSession
name = 'rdp'
connection = RefinitivDataConnection
stream_auto_reconnection = True
authentication_token_endpoint_url = https://api.refinitiv.com/auth/oauth2/v1/token
signon_control = True
server_mode = False
state = OpenState.Closed
session_id = 17
logger_name = sessions.platform.rdp.17

What would be then the config to be able to use udf? Something like below did not work for me:

{
    "sessions": {
        "platform": {
            "default": {
        "app-key": "APP_KEY",
"username": "USERNAME",
"password": "PASSWORD",
                "auto-reconnect": true,
                "server-mode": true,
"signon_control": true
            }
        }
    },
    "apis": {
"data": {
    "datagrid": {
"underlying-platform": "udf"
    }
}
}
}   
icon clock
10 |1500

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

Upvotes
80.1k 257 52 75

@Anastasiia.Shcherbak

As far as I know, the UDF works with the desktop.workspace. You need to run Eikon or Workspace on the maching to use the desktop.workspace session.

"default": "desktop.workspace",

Moreover, no need to overide it on the configuration file.

Please use the configuration file on GitHub.

icon clock
10 |1500

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

Upvotes
25.1k 57 17 14

Hello @Anastasiia.Shcherbak

As mentioned by my colleague, the Platform Session does not support the UDF. You need to use the Desktop Session (the Workspace/Eikon desktop application is required).

I did a quick test with the Desktop Session as follows:

"sessions": {
        "default": "desktop.workspace",
        "desktop": {
            "workspace": {
                "app-key": "App_Key"
            }
        }
    }

Result:

workspace.png

Then when I tested with the Platform Session:

"sessions": {
        "default": "platform.platform",
        "platform": {
            "rdp": {
                "app-key": "App Key",
                "username": "User ID",
                "password": "Password",
                "auto-reconnect": true,
                "server-mode": true,
                "signon_control": true
            }
        }
        
    }

Result:

platform-session.png



workspace.png (65.5 KiB)
icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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