X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1fbf854ce423d2d56723ff10608267403f4916b0..47fd1d6b641a01e7e9d45ee8c7b1519e8a0b03c8:/lib/wlapi/__init__.py?ds=sidebyside diff --git a/lib/wlapi/__init__.py b/lib/wlapi/__init__.py index 3284211a..8491be27 100644 --- a/lib/wlapi/__init__.py +++ b/lib/wlapi/__init__.py @@ -8,7 +8,7 @@ """ import urllib2 import functools -import django.utils.simplejson as json +import json import logging logger = logging.getLogger("fnp.lib.wlapi") @@ -45,10 +45,11 @@ def api_call(path, format="json"): try: anwser = json.load(self.opener.open(rq)) - return generator.send(anwser) - except StopIteration: - # by default, just return the anwser as a shorthand - return anwser + try: + return generator.send(anwser) + except StopIteration: + # by default, just return the anwser as a shorthand + return anwser except urllib2.HTTPError, error: return self._http_error(error) except Exception, error: