From 4831ebb427d7aa388a5c86c56f654b5e1f51f34f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Jun 2014 10:59:50 +0100 Subject: [PATCH] Extract method --- wolframalpha/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index 315068e..b005a23 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -14,6 +14,9 @@ compat.fix_HTTPMessage() class Result(object): def __init__(self, stream): self.tree = etree.parse(stream) + self._handle_error() + + def _handle_error(self): error = self.tree.find('error') if error: code = error.find('code').text