cgi script: get the url of this page
Peter van Kampen
news at woody.datatailors.com
Mon Aug 9 18:43:03 EDT 2004
In article <mailman.1409.1092077336.5135.python-list at python.org>, Matt Price wrote:
> A super simple question:
>
> is there a standard trick to get the url of the current page in a cgi
import os
script = os.environ["SCRIPT_FILENAME"]
Look up the print_environ() function in the cgi-module for your python
version to give you an overview of available information.
> script, or the url from which form data has been passed?? I want to
Hmm. You can try HTTP_REFERER but it depends on several things (browser,
server, cgi-implementation etc.) wether this reports something useful or
not. It is probably more reliably to check REMOTE_ADDR if that would provide
enough information.
Hth,
PterK
--
Peter van Kampen
pterk -- at -- datatailors.com
More information about the Python-list
mailing list