Archive

Posts Tagged ‘python’

Get the browser’s user agent with mod_python

August 7th, 2009 1 comment

I recently discovered the beauty of mod_python and python server pages (psp), and I’ve been slowly replacing the php code on my server as I make changes. One thing that took me awhile to figure out was how to get the user-agent of the requesting client. In the hopes of helping others in the same boat, here’s the line of code:

<%= req.headers_in['User-Agent']  %>


As you can see all the request’s header information is in the req.header_in dictionary.

Share