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
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
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)