mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-17 21:34:34 -05:00
Fix get_json
This commit is contained in:
parent
1a9255c12e
commit
c366276056
@ -169,12 +169,11 @@ class SimpleHttpClient(object):
|
|||||||
On a non-2xx HTTP response. The response body will be used as the
|
On a non-2xx HTTP response. The response body will be used as the
|
||||||
error message.
|
error message.
|
||||||
"""
|
"""
|
||||||
body = yield self.get_raw(uri, args)
|
try:
|
||||||
|
body = yield self.get_raw(uri, args)
|
||||||
if 200 <= response.code < 300:
|
|
||||||
defer.returnValue(json.loads(body))
|
defer.returnValue(json.loads(body))
|
||||||
else:
|
except CodeMessageException as e:
|
||||||
raise self._exceptionFromFailedRequest(response, body)
|
raise self._exceptionFromFailedRequest(e.code, e.msg)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def put_json(self, uri, json_body, args={}):
|
def put_json(self, uri, json_body, args={}):
|
||||||
|
Loading…
Reference in New Issue
Block a user