CGI: how to get referer header?
exnihilo at NOmyrealCAPSbox.com
Sun Mar 23 10:24:59 CET 2003
Skip Montanaro wrote:
> Skip> They should be available in the environment as HTTP_USER_AGENT and
> Skip> HTTP_REFERER. Take a look at
> >> Thanks for the help. I tried using HTTP_USER_AGENT and HTTP_REFERER,
> >> but I get similar results, a tuple containing an empty dictionary.
> Sorry, I should have given a specific example. Try this:
> import os
> print "Referer:", os.environ.get("HTTP_REFERER", "<not present>")
> print "User Agent:", os.environ.get("HTTP_USER_AGENT", "<unknown>")
This works great. Thanks so much for the help ;-)
More information about the Python-list