diff --git a/API.md b/API.md index 1589d312..f49c4b1d 100644 --- a/API.md +++ b/API.md @@ -2645,6 +2645,24 @@ Returns: ``` +### status +Get the current status of Tautulli. + +``` +Required parameters: + None + +Optional parameters: + None + +Returns: + json: + {"result": "success", + "message": "Ok", + } +``` + + ### terminate_session Stop a streaming session. diff --git a/plexpy/webserve.py b/plexpy/webserve.py index fc8b7d8b..8bbb34f8 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -5860,3 +5860,26 @@ class WebInterface(object): @requireAuth() def support(self, query='', **kwargs): return serve_template(templatename="support.html", title="Support") + + @cherrypy.expose + @cherrypy.tools.json_out() + @addtoapi() + def status(self, *args, **kwargs): + """ Get the current status of Tautulli. + + ``` + Required parameters: + None + + Optional parameters: + None + + Returns: + json: + {"result": "success", + "message": "Ok", + } + ``` + """ + cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store" + return {'result': 'success', 'message': 'Ok'} diff --git a/plexpy/webstart.py b/plexpy/webstart.py index 1bddad6a..685d2efc 100644 --- a/plexpy/webstart.py +++ b/plexpy/webstart.py @@ -15,6 +15,7 @@ import os import sys +from urllib import urlencode import plexpy import cherrypy @@ -112,6 +113,9 @@ def initialize(options): '/api': { 'tools.auth_basic.on': False }, + '/status': { + 'tools.auth_basic.on': False + }, '/interfaces': { 'tools.staticdir.on': True, 'tools.staticdir.dir': "interfaces", @@ -231,6 +235,12 @@ class BaseRedirect(object): def index(self): raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT) + @cherrypy.expose + def status(self, *args, **kwargs): + path = '/' + '/'.join(args) if args else '' + query = '?' + urlencode(kwargs) if kwargs else '' + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + 'status' + path + query) + def proxy(): # logger.debug(u"REQUEST URI: %s, HEADER [X-Forwarded-Host]: %s, [X-Host]: %s, [Origin]: %s, [Host]: %s",