Handling rtsp interruption python

I’m using the python deepstream 5.0 api.
There is a way to handle rtsp interruption in the stream and set for example a number of retries?
Because now if the stream end it simply close.

Do you mean you want to handle stream error and retry rtsp connection during playback? This is the function inside RTSP plugin.

You can use rtspsrc element from GStreamer in your application and catch the disconnection message it provides, so you can take an action to retry the rtsp connection.