Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions facebook_business/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ def is_success(self):

json_body = self.json()

if isinstance(json_body, collections_abc.Mapping) and 'error' in json_body:
# Is a dictionary, has error in it
return False
elif bool(json_body):
# Has body and no error
if bool(json_body) and isinstance(json_body, collections_abc.Mapping):
# Is a dictionary
if 'error' in json_body:
# Has 'error' as a key
return False
if 'success' in json_body:
# Has 'success' as a key
return json_body['success']
# API can return a success 200 when service unavailable occurs
return 'Service Unavailable' not in json_body
Expand Down