edit: tweaked it a little bit for my use-case:is_demo_server = '
http://demoapi.trains.allegro.ai ' in Session.get_api_server_host()
is_server_available = requests.get(Session.get_api_server_host() + "/debug.ping").status_code == 200
Hi RipeGoose2 , you can use curl http://<server-ip-or-host-name>:8008/debug.ping
The server should return 200 🙂
Cool. My mistake was that I forgot ok
is a boolean property, not a method 😄 So you can actually do:is_server_available = requests.get(Session.get_api_server_host() + "/debug.ping").ok
ok
basically does what you did yourself 🙂
In your Python script, you can use something like:
` import requests
from trains.backend_api import Session
server_available = requests.get(Session.get_api_server_host() + "/debug.ping").ok() `