Response.json is now a callable

This commit is contained in:
David Baumgold
2013-09-11 10:18:00 -04:00
parent 871ad7d694
commit 6a8546801c

View File

@@ -42,7 +42,7 @@ class GradingService(object):
response.raise_for_status()
return response.json
return response.json()
def post(self, url, data, allow_redirects=False):
"""
@@ -88,9 +88,10 @@ class GradingService(object):
Returns the result of operation(). Does not catch exceptions.
"""
response = operation()
if (response.json
and response.json.get('success') is False
and response.json.get('error') == 'login_required'):
resp_json = response.json()
if (resp_json
and resp_json.get('success') is False
and resp_json.get('error') == 'login_required'):
# apparrently we aren't logged in. Try to fix that.
r = self._login()
if r and not r.get('success'):