From 412a04b16bc760590614bb50b77bba781f456c77 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 3 Sep 2016 11:50:15 -0400 Subject: [PATCH] Rely on presence of 'error' element to detect errors. --- wolframalpha/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index 8bf7708..8d7adf6 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -57,11 +57,10 @@ class Client(object): class ErrorHandler(object): @staticmethod def _handle_error(resp): - error_state = resp['@error'] - if error_state == 'false': + error = resp.get('error') + if not error: return - error = resp['error'] code = error['code'] msg = error['msg'] template = 'Error {code}: {msg}'