コード例 #1
0
ファイル: http.py プロジェクト: asavoy/pyrax
def http_log_resp(resp, body):
    """
    When pyrax.get_http_debug() is True, outputs the response received
    from the API request.
    """
    if not pyrax.get_http_debug():
        return
    pyrax._logger.debug("RESP: %s %s\n", resp, body)
コード例 #2
0
ファイル: http.py プロジェクト: annegentle/pyrax
def http_log_resp(resp, body):
    """
    When pyrax.get_http_debug() is True, outputs the response received
    from the API request.
    """
    if not pyrax.get_http_debug():
        return
    log = logging.getLogger("pyrax")
    log.debug("RESP: %s %s\n", resp, body)
コード例 #3
0
ファイル: http.py プロジェクト: rackspace/pyrax
def http_log_resp(resp, body):
    """
    When pyrax.get_http_debug() is True, outputs the response received
    from the API request.
    """
    if not pyrax.get_http_debug():
        return
    log = logging.getLogger("pyrax")
    log.debug("RESP: %s\n%s", resp, resp.headers)
    if body:
        log.debug("RESP BODY: %s", body)
コード例 #4
0
ファイル: http.py プロジェクト: annegentle/pyrax
def http_log_req(method, uri, args, kwargs):
    """
    When pyrax.get_http_debug() is True, outputs the equivalent `curl`
    command for the API request being made.
    """
    if not pyrax.get_http_debug():
        return
    string_parts = ["curl -i -X %s" % method]
    for element in args:
        string_parts.append("%s" % element)
    for element in kwargs["headers"]:
        header = "-H '%s: %s'" % (element, kwargs["headers"][element])
        string_parts.append(header)
    string_parts.append(uri)
    log = logging.getLogger("pyrax")
    log.debug("\nREQ: %s\n" % " ".join(string_parts))
    if "body" in kwargs:
        pyrax._logger.debug("REQ BODY: %s\n" % (kwargs["body"]))
コード例 #5
0
ファイル: http.py プロジェクト: abhikalakuntla/pyrax
def http_log_req(method, uri, args, kwargs):
    """
    When pyrax.get_http_debug() is True, outputs the equivalent `curl`
    command for the API request being made.
    """
    if not pyrax.get_http_debug():
        return
    string_parts = ["curl -i -X %s" % method]
    for element in args:
        string_parts.append("%s" % element)
    for element in kwargs["headers"]:
        header = "-H '%s: %s'" % (element, kwargs["headers"][element])
        string_parts.append(header)
    string_parts.append(uri)
    log = logging.getLogger("pyrax")
    log.debug("\nREQ: %s\n" % " ".join(string_parts))
    if "body" in kwargs:
        pyrax._logger.debug("REQ BODY: %s\n" % (kwargs["body"]))
コード例 #6
0
ファイル: http.py プロジェクト: asavoy/pyrax
def http_log_req(args, kwargs):
    """
    When pyrax.get_http_debug() is True, outputs the equivalent `curl`
    command for the API request being made.
    """
    if not pyrax.get_http_debug():
        return
    string_parts = ["curl -i"]
    for element in args:
        if element in ("GET", "POST", "PUT", "DELETE", "HEAD", "PATCH"):
            string_parts.append(" -X %s" % element)
        else:
            string_parts.append(" %s" % element)

    for element in kwargs["headers"]:
        header = " -H '%s: %s'" % (element, kwargs["headers"][element])
        string_parts.append(header)

    pyrax._logger.debug("\nREQ: %s\n" % "".join(string_parts))
    if "body" in kwargs:
        pyrax._logger.debug("REQ BODY: %s\n" % (kwargs["body"]))