talkomatic.py 0.1.2
An easy-to-use Python versatile wrapper for the Talkomatic Bot interface ensuring best practices for making bots, and handling the REST API.
 
Loading...
Searching...
No Matches
server_health.py
Go to the documentation of this file.
1"""
2server_health.py
3
4This example shows how to check the server health using the
5Talkomatic REST API.
6"""
7
8from talkomatic.api.v1 import ServerHealth # we import the ServerHealth class from the Talkomatic API module
9
10from datetime import datetime # we import the datetime module to format the uptime
11
12
13health = ServerHealth.get() # we get the server health using the get method
14
15print(f"Server status: {health.status}") # we print the server status
16if health.status:
17 uptime = datetime.fromtimestamp(health.uptime).strftime("%H:%M:%S") # we format the uptime
18 print(f"Server uptime: {uptime}") # we print the server uptime
19 print(f"Server version: {health.server_version}") # we print the server version