API - Adding current version to 'System Information' endpoint, bumping API docs, Re #1429

This commit is contained in:
dgtlmoon
2023-02-22 23:34:36 +01:00
parent aaad71fc19
commit 3e98c8ae4b
3 changed files with 50 additions and 25 deletions

View File

@@ -264,6 +264,22 @@ class SystemInfo(Resource):
@auth.check_token
def get(self):
"""
@api {get} /api/v1/systeminfo Return system info
@apiDescription Return some info about the current system state
@apiExample {curl} Example usage:
curl http://localhost:4000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
HTTP/1.0 200
{
'queue_size': 10 ,
'overdue_watches': ["watch-uuid-list"],
'uptime': 38344.55,
'watch_count': 800,
'version': "0.40.1"
}
@apiName Get Info
@apiGroup System Information
"""
import time
overdue_watches = []
@@ -282,10 +298,11 @@ class SystemInfo(Resource):
# Allow 5 minutes of grace time before we decide it's overdue
if time_since_check - (5 * 60) > t:
overdue_watches.append(uuid)
from changedetectionio import __version__ as main_version
return {
'queue_size': self.update_q.qsize(),
'overdue_watches': overdue_watches,
'uptime': round(time.time() - self.datastore.start_time, 2),
'watch_count': len(self.datastore.data.get('watching', {}))
'watch_count': len(self.datastore.data.get('watching', {})),
'version': main_version
}, 200