Hi community!
I am connecting to pricing streams using the LSEG Python library (version lseg.data==2.0.1)
Here is a sample code. I am then able to register callbacks with the stream and listen to the data.
session = ld.session.platform.Definition(
app_key=api_key,
grant=ld.session.platform.ClientCredentials(
client_id='...',
client_secret='...'
),
signon_control=False,
).get_session()
session.open()
streams = ld.content.pricing.Definition(
universe=REQUESTED_RICS,
fields=REQUESTED_FIELDS
).get_stream(session)
streams.open()
My question is about handling connection problems. When I simulate internet connectivity going down on my box, the library does not throw any errors and the websocket connection does not seem to time out. How to best handle such issues?
Ideal for my use case would be to get an exception so that I can exit and launch a new process right away.
Thanks,
Bart