LSEG Data Library v2 authentication

Hello All,

I would like to ask you for advice, so one of my client recently receive RTO Service ID and he decide that he would like to use LSEG Data Library for Python in order to get data. He most likely use examples from our github page because in his application in order to authenticate he require "app-key", "username", "password" like below and this also lead me to conclusion that authentication method that he use is v1 which for RTO ServiceID is not the best option.

"sessions": {

"default": "platform.ldp",

"platform": {

"ldp": {

"app-key": "YOUR APP KEY GOES HERE!",

"username": "YOUR LDP LOGIN OR MACHINE GOES HERE!",

"password": "YOUR LDP PASSWORD GOES HERE!"

},

"deployed": {

"app-key": "YOUR APP KEY GOES HERE!",

"realtime-distribution-system": {

"url" : "YOUR DEPLOYED HOST:PORT GOES HERE!",

"dacs" : {

"username" : "YOUR DACS ID GOES HERE!",

"application-id" : 256,

"position" : ""

}

My question is: is it possible to that he can use v2 authentication method in LSEG Data Library (I have seen that this is possible but I could not find example of it) and if yes, is app-key still require? SO if it require still can I just generate it on this page https://emea1-apps.platform.refinitiv.com/apps/AppkeyGenerato and it will be working with ServiceID?

Answers

  • Hello @Kacper_Piernicki1

    The v2 authentication can be used, but it is not defined in the configuration file. I was able to define and use it in the code as follows:

    session = ld.session.platform.Definition(
      app_key = "NOT_NEEDED", 
      grant = ld.session.platform.ClientCredentials(
        client_id="THE_CLIENT_ID", 
        client_secret="THE_CLIENT_SECRET"
      )
    ).get_session()
    
    session.open()
    

    then requesting the real time data -

    ld.session.set_default(session)
    
    response = ld.content.pricing.Definition(
      ['EUR=', 'GBP=', 'JPY=', 'CAD='],
      fields=['BID', 'ASK']
    ).get_data()
    
    print(response.data.df)
    
  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Kacper_Piernicki1

    Please try this one.

     "platform": {         
                "ldpv2": {                
                    "client_id": "<client_id>",
                    "client_secret": "<client_secret>",
                    "app-key": "<app_key>"
                },