Added system endpoints

This commit is contained in:
sneakypete81 2013-11-03 12:37:31 +00:00
parent ebaf3bc036
commit 09203ff2b8
3 changed files with 99 additions and 0 deletions

View 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"]