Sometimes, we want to see the entire HTTP request that’s being sent with Python.
In this article, we’ll look at how to see the entire HTTP request that’s being sent with Python.
How to see the entire HTTP request that’s being sent with Python?
To see the entire HTTP request that’s being sent with Python, we can use the requests
module.
For instance, we write
r = requests.get('https://api.github.com', auth=('user', 'pass'))
to make a GET request.
We can get the request content from r.request
.
And we can get the request headers with r.request.headers
.
And we can get the request body data with r.request.data
.
Conclusion
To see the entire HTTP request that’s being sent with Python, we can use the requests
module.