From e0e7d68df2119eddab3c35bc12c2fb0f8a30c248 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sat, 28 Apr 2018 18:39:42 -0700 Subject: [PATCH] API success result for empty response data (Fixes Tautulli/Tautulli-Issues#56) --- plexpy/api2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plexpy/api2.py b/plexpy/api2.py index af5bbb7d..681f5469 100644 --- a/plexpy/api2.py +++ b/plexpy/api2.py @@ -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)