How to view Boto3 HTTPS request string

zachhilbert picture zachhilbert · Apr 28, 2015 · Viewed 12k times · Source

I have been able to view the attributes of the PreparedRequest that botocore sends, but I'm wondering how I can view the exact request string that is sent to AWS. I need the exact request string to be able to compare it to another application I'm testing AWS calls with.

Answer

garnaat picture garnaat · May 15, 2015

You could also enable debug logging in boto3. That will log all requests and responses as well as lots of other things. Its a bit obscure to enable it:

import boto3
boto3.set_stream_logger(name='botocore')

The reason you have to specify botocore as the name to log is that all of the actual requests and responses happen at the botocore layer.