Remove error cmd from API

This commit is contained in:
JonnyWong16 2016-11-11 12:59:35 -08:00
parent 21d9091b43
commit 960b601384
3 changed files with 11 additions and 31 deletions

8
API.md
View file

@ -145,14 +145,6 @@ Returns:
### delete_temp_sessions ### delete_temp_sessions
Flush out all of the temporary sessions in the database. Flush out all of the temporary sessions in the database.
```
Required parameters:
None
Required parameters:
None
```
### delete_user ### delete_user
Delete a user from PlexPy. Also erases all history for the user. Delete a user from PlexPy. Also erases all history for the user.

View file

@ -64,12 +64,12 @@ class API2:
return docs return docs
def docs_md(self): def docs_md(self):
""" Return the api docs formatted with markdown. """ """ Return the api docs formatted with markdown."""
return self._api_make_md() return self._api_make_md()
def docs(self): def docs(self):
""" Return the api docs as a dict where commands are keys, docstring are value. """ """ Return the api docs as a dict where commands are keys, docstring are value."""
return self._api_docs() return self._api_docs()
@ -298,7 +298,7 @@ class API2:
return rows return rows
def backup_config(self): def backup_config(self):
""" Create a manual backup of the `config.ini` file. """ """ Create a manual backup of the `config.ini` file."""
data = config.make_backup() data = config.make_backup()
self._api_result_type = 'success' if data else 'error' self._api_result_type = 'success' if data else 'error'
@ -306,7 +306,7 @@ class API2:
return data return data
def backup_db(self): def backup_db(self):
""" Create a manual backup of the `plexpy.db` file. """ """ Create a manual backup of the `plexpy.db` file."""
data = database.make_backup() data = database.make_backup()
self._api_result_type = 'success' if data else 'error' self._api_result_type = 'success' if data else 'error'
@ -314,28 +314,28 @@ class API2:
return data return data
def restart(self, **kwargs): def restart(self, **kwargs):
""" Restart PlexPy. """ """ Restart PlexPy."""
plexpy.SIGNAL = 'restart' plexpy.SIGNAL = 'restart'
self._api_msg = 'Restarting plexpy' self._api_msg = 'Restarting plexpy'
self._api_result_type = 'success' self._api_result_type = 'success'
def update(self, **kwargs): def update(self, **kwargs):
""" Check for PlexPy updates on Github. """ """ Check for PlexPy updates on Github."""
plexpy.SIGNAL = 'update' plexpy.SIGNAL = 'update'
self._api_msg = 'Updating plexpy' self._api_msg = 'Updating plexpy'
self._api_result_type = 'success' self._api_result_type = 'success'
def refresh_libraries_list(self, **kwargs): def refresh_libraries_list(self, **kwargs):
""" Refresh the PlexPy libraries list. """ """ Refresh the PlexPy libraries list."""
data = pmsconnect.refresh_libraries() data = pmsconnect.refresh_libraries()
self._api_result_type = 'success' if data else 'error' self._api_result_type = 'success' if data else 'error'
return data return data
def refresh_users_list(self, **kwargs): def refresh_users_list(self, **kwargs):
""" Refresh the PlexPy users list. """ """ Refresh the PlexPy users list."""
data = plextv.refresh_users() data = plextv.refresh_users()
self._api_result_type = 'success' if data else 'error' self._api_result_type = 'success' if data else 'error'
@ -427,9 +427,6 @@ General optional parameters:
return data return data
def error(self, **kwargs):
return 1 / 0
def _api_responds(self, result_type='error', data=None, msg=''): def _api_responds(self, result_type='error', data=None, msg=''):
""" Formats the result to a predefined dict so we can hange it the to """ Formats the result to a predefined dict so we can hange it the to
the desired output by _api_out_as """ the desired output by _api_out_as """
@ -513,12 +510,12 @@ General optional parameters:
result = call(**self._api_kwargs) result = call(**self._api_kwargs)
except Exception as e: except Exception as e:
logger.error(u'PlexPy APIv2 :: Failed to run %s %s %s' % (self._api_cmd, self._api_kwargs, e)) logger.error(u'PlexPy APIv2 :: Failed to run %s with %s: %s' % (self._api_cmd, self._api_kwargs, e))
if self._api_debug: if self._api_debug:
cherrypy.request.show_tracebacks = True cherrypy.request.show_tracebacks = True
# Reraise the exception so the traceback hits the browser # Reraise the exception so the traceback hits the browser
raise raise
self._api_msg = 'Check the log' self._api_msg = 'Check the logs'
ret = None ret = None
# The api decorated function can return different result types. # The api decorated function can return different result types.

View file

@ -331,16 +331,7 @@ class WebInterface(object):
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
@addtoapi() @addtoapi()
def delete_temp_sessions(self, **kwargs): def delete_temp_sessions(self, **kwargs):
""" Flush out all of the temporary sessions in the database. """ Flush out all of the temporary sessions in the database."""
```
Required parameters:
None
Required parameters:
None
```
"""
result = database.delete_sessions() result = database.delete_sessions()