Question

how do I get the whole raw http request in the python framework bottle?

I need something like this:

GET\n
myurl.com\n
/\n
attribute=value
&att2=value2

I need this to sign my http api requests

Was it helpful?

Solution

As far as I can tell from the docs you can't get the data in raw format.

What you can do is reconstruct it using bottle.request.data and bottle.request.headers. That may be enough for your purposes.

OTHER TIPS

If you just want to print the request you can do the following:

headers_string = ['{}: {}'.format(h, request.headers.get(h)) for h in request.headers.keys()] 
print('URL={}, method={}\nheaders:\n{}'.format(request.url, request.method, '\n'.join(headers_string)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top