Exemplo n.º 1
0
 def do_put(self, url, values):
     resp = put(url, json=values)
     if resp.status_code != 200:
         raise exc.GluonClientException('Bad return status %d' %
                                        resp.status_code,
                                        status_code=resp.status_code)
     try:
         rv = json.loads(resp.content)
     except Exception as e:
         raise exc.MalformedResponseBody(
             reason="JSON unreadable: %s on %s" % (e.args[0], resp.content))
     return rv
Exemplo n.º 2
0
 def json_get(self, url):
     resp = get(url)
     if resp.status_code != 200:
         raise exc.GluonClientException('Bad return status %d' %
                                        resp.status_code,
                                        status_code=resp.status_code)
     try:
         rv = json.loads(resp.content)
     except Exception as e:
         msg = "JSON unreadable: %s on %s" % (e.args[0], resp.content)
         raise exc.MalformedResponseBody(reason=msg)
     return rv
Exemplo n.º 3
0
 def do_delete(self, url):
     resp = delete(url)
     if resp.status_code != 200:
         raise exc.GluonClientException('Bad return status %d' %
                                        resp.status_code,
                                        status_code=resp.status_code)