def check_if_success()

in hugegraph-python-client/src/pyhugegraph/utils/util.py [0:0]


def check_if_success(response, error=None):
    if (not str(response.status_code).startswith("20")) and check_if_authorized(response):
        if error is None:
            error = NotFoundError(response.content)

        req = response.request
        req_body = req.body if req.body else "Empty body"
        response_body = response.text if response.text else "Empty body"
        log.error("Error-Client: Request URL: %s, Request Body: %s, Response Body: %s",
                  req.url, req_body, response_body)
        raise error
    return True