How to check connectivity status with Python API

Hi,


I'd like to know how I can check the connectivity status with the refinitiv.data Python API (through the platform deployed connection)?

Can I also set timeout with call like this?

1686054131033.png


Thank you for your help.

Regards

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hi @fabien.marcaillou

    You can check the EX-4.01.01-Sessions.ipynb example in Example.DataLibrary.Python/Examples /4-Session/ GitHub repository.

    Example Code:

    session = rd.session.platform.Definition(
        app_key = APP_KEY, 
        deployed_platform_host = 'localhost',
        deployed_platform_username = '<My DACS Username>'
    ).get_session()
    session.open()
    print(session.open_state) #OpenState.Opened

    Result when testing with my local RTDS server:

    ads-session.png

    I hope this information helps.


Answers

  • Hi
    @wasin.w ,


    Thank you for your suggestion, I already tried it but it's not giving a reliable state.

    For testing purpose i've closed my proxy (to be disconnected from the ATS) however it still giving me an "Opened" state.

    Do you have an alternative solution?

    Regards


  • Hello @fabien.marcaillou

    Thank you for the information. Does your deployment scenario look like the following diagram?

    diagram-1.png

    If so, please be informed that the library can detect a connection status with its upstream (ADS) only, not the source/feed like ATS, ADH, or other OMM IProviders.

    As long as a connection between the library and ADS is still fine, the session.open_state code always returns "Opened".

    diagram-2.png