def pretty_print_post ( req ) : print ( ( '{}\n{}\n{}\n\n{}' . format ( '-----------START-----------' , req . method + ' ' + req . url , '\n' . join ( '{}: {}' . format ( k , v ) for k , v in list ( req . headers . items ( ) ) ) , req . body , ) ) )
how to print the contents of a python url request
Helper to print a prepared query . Useful to debug a POST query .
def pretty_print_post(req):
    """Helper to print a "prepared" query. Useful to debug a POST query.

    However pay attention at the formatting used in
    this function because it is programmed to be pretty
    printed and may differ from the actual request.
    """
    print(('{}\n{}\n{}\n\n{}'.format(
        '-----------START-----------',
        req.method + ' ' + req.url,
        '\n'.join('{}: {}'.format(k, v) for k, v in list(req.headers.items())),
        req.body,
    )))