Example #1
0
 def _proxy(self, method, url, data=None, headers=None):
     if data is not None:
         data = json.dumps(data)
     status, headers, body = get_url(url, method, data, headers)
     if body:
         try:
             body = json.loads(body)
         except Exception:
             logger.error("bad json body from sreg (%s): %s" %
                                                     (url, body))
             raise  # XXX
     return status, body
Example #2
0
 def _proxy(self, method, url, data=None, headers=None):
     if data is not None:
         data = json.dumps(data)
     status, headers, body = get_url(url, method, data, headers)
     if body:
         try:
             body = json.loads(body)
         except ValueError:
             logger.error("bad json body from sreg (%s): %s" %
                                                     (url, body))
             raise BackendError('Bad answer from proxy')
     return status, body