CGI: how to get referer header?
nihilo
exnihilo at NOmyrealCAPSbox.com
Sun Mar 23 04:24:59 EST 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>")
>
> Skip
>
This works great. Thanks so much for the help ;-)
nihilo
More information about the Python-list
mailing list