How to stop Python Data library from retrying connection

I am testing the new python api to connect to a deployed TREP server.

https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-library-for-python

And I follow this example to open a streaming to retrieve live prices.

https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python/blob/main/Tutorials/2.Content/2.2-Pricing/TUT_2.2.02-Pricing-StreamingCache.ipynb

What I found is if I provide incorrect username, the stream will keep retrying and never terminate the thread.

the session.stream_auto_reconnection is hardcoded to True and cannot be configured.

calling stream.close() also raise error "AttributeError: 'NoneType' object has no attribute 'remove_listener'". I guess it is because stream is pending to be opened, so you cant really close it.


What should I do to stop stream from reconnecting or to terminate it?

Best Answer

Answers