I am trying to print the POST request that I am doing using my python script. I was wondering if there is a way to print the post request so as to see how the parameters are passed through the script which I wish to compare it with the browser. I read through the urllib2 api but was not able to find a function that could help me in printing my POST request. Any pointers on this is greatly appreciated
Share
If you are using
urllib2.Request, you must provide the body of the POST request as an application/x-www-form-urlencoded string.Since you are responsible for building the POST body, you can easily print or log it.
Edit
There is also
urllib2.Request.get_data(). Maybe you can us this.Edit 2
Use it like this: