Cannot open lseg data session

Hello,

I'm trying to migrate my scripts from refinitiv-data api so the LSEG-data api.

I'm trying to create a plateform session, using a lseg-data.config.json file.

I first read that config file, using

ld.open_session(config_name = "lseg-data.config.json")

.

But when trying to test my connection using a simple API call, like

ld.get_history("AAPL.O")

I get

LDError: No data to return, please check errors: ERROR: No successful response.(401, Authorization header is missing)

Here is my config file :

{
"http": {
"request-timeout": 60
},

"logs": {
"level": "debug",
"transports": {
"console": {
"enabled": false
},
"file": {
"enabled": false,
"name": "lseg-data-lib.log"
}
}
},
"sessions": {
"default": "platform.ldp",
"platform": {
"ldp": {
"app-key": "appkey",
"username": "username",
"password": "password",
"signon_control": true
},
"deployed": {
"app-key": "appkey",
"realtime-distribution-system": {
"url": "ws://ADS1:15000",
"dacs": {
"username": "username",
"application-id": id,
"position": ""
}
}
}
},
"desktop": {
"workspace": {
"app-key": "appkey"
}
}
}
}

Anyone has an idea of what i'm missing ?

Thank you.

Best Answer

Answers

  • Hello @adam.leroux

    You have debugging enabled - please paste the complete log messages. Are you able to create and open the session successfully? You can try one of the basic examples here.

  • adam.leroux
    adam.leroux Newcomer

    Hello Gurpeet, thank you for your answer,

    I have been able to open a session using :

    session = ld.session.platform.Definition(    app_key = appkey,     grant = ld.session.platform.GrantPassword(        username = username,         password = pwd    ),    signon_control=True).get_session().

    As you can see in this part of the log, the session is successfully opened :

    Session created: PlatformSession

    name = defaultconnection = PlatformData

    Connection

    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 = 0

    logger_name = sessions.platform.default.0

    and after doing session.open() :

    DEBUG:sessions.platform.default.0:Session.update_access_token(access_token='XXX')
    [2025-05-27T08:22:32.169568+00:00] - [DEBUG] - [sessions.platform.default.0] - [130721702053440] | AuthManager-Thread
    AuthManager: Refresh token will be requested in 299 seconds
    DEBUG:sessions.platform.default.0:AuthManager: Refresh token will be requested in 299 seconds
    [2025-05-27T08:22:32.169667+00:00] - [DEBUG] - [sessions.platform.default.0] - [130723949191168] | MainThread
    AuthManager: end authorize, result True
    DEBUG:sessions.platform.default.0:AuthManager: end authorize, result True
    [2025-05-27T08:22:32.179932+00:00] - [DEBUG] - [sessions.platform.default.0] - [130723949191168] | MainThread
    Opened session
    DEBUG:sessions.platform.default.0:Opened session

    However when i try to test the connection using a simple call

    ld.get_history("ESc1")

    I get

    AttributeError: No default session created yet. Please create a session first!

    Any ideas ?

    Thank you

  • adam.leroux
    adam.leroux Newcomer

    Maybe one more piece of information :

    I re ran the simple

    ld.open_session()

    with my lseg-data.config.json file as before.

    The session opens successfully

    Opened session

    DEBUG:sessions.platform.ldp.0:Opened session

    However when i call

    ld.get_history("ESc1")

    I see the correct data in the debug print, but i get

    TypeError: NDFrame.infer_objects() got an unexpected keyword argument 'copy'

    Not sure if this is related to the session issue

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @adam.leroux

    What version of the Pandas library are you using?

    It requires pandas<3.0,>=2.0.

  • wasin.w
    wasin.w admin

    Hello @adam.leroux

    If you need to create a session with session = ld.session.platform.Definition code, you need to set that session to a LD default session before start call get_data get_history, etc. methods.

    session = ld.session.platform.Definition(
    app_key = os.getenv("APP_KEY"),
    grant = ld.session.platform.GrantPassword(
    username = os.getenv("USERNAME"),
    password = os.getenv("PASSWORD")
    ),
    signon_control=True
    ).get_session()

    ld.session.set_default(session)

    session.open()

    ld.get_history("EUR=")
    #Got Data