From c3b3e69d5d60ca37ca1086a68f5094f4c7498aa9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Jun 2014 10:56:42 +0100 Subject: [PATCH] Simple refactor --- wolframalpha/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index fd7feb7..e991559 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -14,7 +14,8 @@ compat.fix_HTTPMessage() class Result(object): def __init__(self, stream): self.tree = etree.parse(stream) - if self.tree.getroot().find('error') is not None: + error = self.tree.find('error') + if error: raise Exception('you may have entered the wrong appid') def __iter__(self):