Sometimes, we want to get all the request headers in Python Django.
In this article, we’ll look at how to get all the request headers in Python Django.
How to get all the request headers in Python Django?
To get all the request headers in Python Django, we can use the request.headers
property.
For instance, in our view, we write
request.headers['User-Agent']
to get the User-Agent
request header.
request.headers
is a dict.
Conclusion
To get all the request headers in Python Django, we can use the request.headers
property.