Skip to content

Commit 78f20c1

Browse files
authored
Merge pull request #454 from Stefal/api_get_version
simple api route
2 parents 6cd5d52 + ac86526 commit 78f20c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

web_app/server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import subprocess
6767
import psutil
6868
import distro
69+
import socket
6970

7071
from werkzeug.security import generate_password_hash
7172
from werkzeug.security import check_password_hash
@@ -531,6 +532,18 @@ def diagnostic():
531532
return render_template('diagnostic.html', logs = logs)
532533

533534

535+
@app.route('/api/v1/infos', methods=['GET'])
536+
def get_infos():
537+
"""Small api route to get basic informations about the base station"""
538+
539+
infos = {"app" : "RTKBase",
540+
"app_version" : rtkbaseconfig.get("general", "version"),
541+
"url" : html.escape(request.base_url),
542+
"fqdn" : socket.getfqdn(),
543+
"uptime" : get_uptime(),
544+
"hostname" : socket.gethostname()}
545+
return json.dumps(infos)
546+
534547
#### Handle connect/disconnect events ####
535548

536549
@socketio.on("connect", namespace="/test")

0 commit comments

Comments
 (0)