Passing cgi parameters to script...

Mike Meyer mwm at mired.org
Thu Dec 29 11:59:14 EST 2005


"sophie_newbie" <paulgeeleher at gmail.com> writes:
> Is there any way that I can pass cgi parameters to my script locally,
> before i upload it to the webserver, so that i can debug it.
>
> Normally I would pass parameters like this:
>
> www.webserver.com/script.cgi?TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT

CGI paramaters are set in the environment. On Unix, in an sh-like
shell, do:

QUERY_STRING='TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT' www.webserver.com/script.cgi

Depending on the package you're using for handling CGI, you may need
to set other CGI parameters as well. The traceback from trying this
should give you a KeyError naming the environment variable it's
looking for.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list