question

Upvotes
Accepted
5 0 1 7

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

python#technology#productrdp-apiapiconnection
1686054131033.png (11.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.

Upvote
Accepted
25.7k 58 17 14

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.



ads-session.png (50.8 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.

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


Upvote
25.7k 58 17 14

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



diagram-1.png (12.8 KiB)
diagram-2.png (14.6 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.