I have a service and my code tries to connect to it with API:
import my_srvice_api
It haven't any mechanism for timeout and my code stays waiting if the service is not running, I want to try and after timeout raise the exception, how can I do that like this:
timeout = 3
try:
obj = my_service_api.connect()
except TimeoutException as e:
print("service my_service start")