def _get_request_string()

in ec2stack/helpers.py [0:0]


def _get_request_string(data, method=None, host=None, path=None):
    """
    Creates the request string.

    @param data: Data of the request.
    @param method: HTTP method used.
    @param host: HTTP host.
    @param path: HTTP path.
    @return: Request string.
    """
    if method is None:
        method = request.method
    if host is None:
        host = request.host
    if path is None:
        path = request.path

    query_string = _get_query_string(data)

    request_string = '\n'.join(
        [method, host, path, query_string]
    )

    return request_string.encode('utf-8')