Added system endpoints
This commit is contained in:
parent
ebaf3bc036
commit
09203ff2b8
3 changed files with 99 additions and 0 deletions
27
trovebox/api/api_system.py
Normal file
27
trovebox/api/api_system.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
api_system.py : Trovebox System API Classes
|
||||
"""
|
||||
from .api_base import ApiBase
|
||||
|
||||
class ApiSystem(ApiBase):
|
||||
""" Definitions of /system/ API endpoints """
|
||||
def version(self, **kwds):
|
||||
"""
|
||||
Endpoint: /system/version.json
|
||||
|
||||
Returns a dictionary containing the various server version strings
|
||||
"""
|
||||
return self._client.get("/system/version.json", **kwds)["result"]
|
||||
|
||||
def diagnostics(self, **kwds):
|
||||
"""
|
||||
Endpoint: /system/diagnostics.json
|
||||
|
||||
Runs a set of diagnostic tests on the server.
|
||||
Returns a dictionary containing the results.
|
||||
"""
|
||||
# Don't process the result automatically, since this raises an exception
|
||||
# on failure, which doesn't provide the cause of the failure
|
||||
self._client.get("/system/diagnostics.json", process_response=False,
|
||||
**kwds)
|
||||
return self._client.last_response.json()["result"]
|
Loading…
Add table
Add a link
Reference in a new issue