mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
API success result for empty response data (Fixes Tautulli/Tautulli-Issues#56)
This commit is contained in:
parent
cf73639281
commit
e0e7d68df2
1 changed files with 5 additions and 5 deletions
|
@ -530,7 +530,7 @@ General optional parameters:
|
|||
return data
|
||||
|
||||
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 change it the to
|
||||
the desired output by _api_out_as """
|
||||
|
||||
if data is None:
|
||||
|
@ -637,19 +637,19 @@ General optional parameters:
|
|||
except:
|
||||
pass
|
||||
|
||||
# Fallback if we cant "parse the reponse"
|
||||
# Fallback if we cant "parse the response"
|
||||
if ret is None:
|
||||
ret = result
|
||||
|
||||
if ret or self._api_result_type == 'success':
|
||||
if ret is not None or self._api_result_type == 'success':
|
||||
# To allow override for restart etc
|
||||
# if the call returns some data we are gonna assume its a success
|
||||
self._api_result_type = 'success'
|
||||
else:
|
||||
self._api_result_type = 'error'
|
||||
|
||||
# Since some of them metods use a api like response for the ui
|
||||
# {result: error, message: 'Some shit happend'}
|
||||
# Since some of them methods use a api like response for the ui
|
||||
# {result: error, message: 'Some shit happened'}
|
||||
if isinstance(ret, dict):
|
||||
if ret.get('message'):
|
||||
self._api_msg = ret.pop('message', None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue