How to use rdp.session.platform.Definition with RDP Password in refinitiv-data v1.6.2?

Hi Refinitiv Developer Community,
I'm trying to authenticate to the Refinitiv Data Platform using the refinitiv-data Python library, specifically version 1.6.2. My environment is Python 3.12 running on Ubuntu.
My goal is to establish a platform session using my RDP credentials (App Key, RDP Username [which is a Machine ID like GE-A-00220069-3--...], and Password Machine for ID).
I'm attempting to use the rdp.session.platform.Definition class to configure the session and then open it with rdp.open_session(config=...), similar to the structure below:
import refinitiv.data as rdp
import traceback
import sys

RDP Credentials (Using placeholders)

RDP_APP_KEY = "YOUR_APP_KEY_PLACEHOLDER"
RDP_USERNAME = "YOUR_MACHINE_ID" # e.g., GE-A-00220069-3--...
RDP_PASSWORD = "YOUR_RDP_PASSWORD_PLACEHOLDER"

try:
print("Defining RDP platform session configuration...")

# --- Attempting to configure platform session ---
# Trying different parameter combinations here causes TypeErrors
session_definition = rdp.session.platform.Definition(
    app_key=RDP_APP_KEY,
    # What are the correct parameter names here for v1.6.2?
    # Attempts:
    # 1. username=RDP_USERNAME, password=RDP_PASSWORD
    #    => TypeError: ... got an unexpected keyword argument 'username'
    # 2. rdp_signon_username=RDP_USERNAME, rdp_password=RDP_PASSWORD
    #    => TypeError: ... got an unexpected keyword argument 'rdp_signon_username'
    # 3. Also tried adding sign_on_control=True (combined with above)
    #    => TypeError: ... got an unexpected keyword argument 'sign_on_control'

    # Need the correct parameter names below:
    parameter_name_for_username = RDP_USERNAME,
    parameter_name_for_password = RDP_PASSWORD
)

print("Opening Refinitiv Data Platform session using definition...")
rdp.open_session(config=session_definition)
print("Session opening process initiated...")

# ... rest of the code to use the session ...

except rdp.errors.SessionError as session_error:
# Note: Based on previous errors, SessionError might also not be the correct base class in v1.6.2
print(f"Session Error: {session_error}", file=sys.stderr)
traceback.print_exc()
except Exception as e: # This catches the TypeError etc.
print(f"An unexpected error occurred during setup or execution: {e}", file=sys.stderr)
traceback.print_exc()
finally:
try:
print("Closing session...")
rdp.close_session()
except Exception as close_session_err:
print(f"Error closing session: {close_session_err}", file=sys.stderr)
print("Cleanup finished.")

As noted in the code comments, I've tried various keyword arguments like username, password, rdp_signon_username, rdp_password, and sign_on_control, but they all result in a TypeError: Definition.init() got an unexpected keyword argument '...'.
Could someone please advise on the correct keyword arguments required by rdp.session.platform.Definition in refinitiv-data version 1.6.2 when authenticating with an App Key and RDP Username/Password? Or is there a different preferred method for this authentication type in v1.6.2?
Any help or pointers to the relevant v1.6.2 documentation would be greatly appreciated!
Thanks,
Ian

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Hello @ianzhu

    Please use the latest LD Library for Python. You can see the example of creating the platform session in the provided samples.

    import refinitiv.data as rd
    
    session = rd.session.platform.Definition(
      app_key = RDP_APP_KEY,
      grant = rd.session.platform.GrantPassword(
        username = RDP_USERNAME,
        password = RDP_PASSWORD,
      ),
      signon_control=True,
    ).get_session()
    
    session.open()
    
  • ianzhu
    ianzhu LSEG

    Thanks@

    Gurpreet

    111.png

    I have already connected using RDP v1 and can retrieve data. The username is the machine ID.
    I have another question: if I use RDP v2, what should the parameters be? My RDP v2 account looks like this.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @ianzhu

    The code looks like this:

    session = ld.session.platform.Definition(
        app_key = 'APP_KEY', 
        grant = ld.session.platform.ClientCredentials("<CLIENT_ID>", "<CLIENT_SECRET>")
        ).get_session()
    session.open()

    The format of CLIENT_ID is GE-XXX.

  • ianzhu
    ianzhu LSEG

    Thanks @But mine is RDP V2, and it seems I don’t see a client ID or password.
    How can I obtain the client ID for V2 account?
    My other RDP V1 account does have a machine ID and password.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    Typically, RDP V2 is used to connect to Real-Time Optimized service.

    Please check this Account authorization V1 to V2 migration cheat sheet article.

    For internal accounts, you may need to request an account from the service now.

    For client's accounts, please contact the client's LSEG account team or sales team.

  • ianzhu
    ianzhu LSEG

    Thank you. I am testing the RDP connection using Python on my own.

    It seems I need to request the CLIENT_ID and CLIENT_SECRET through ServiceNow.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.