ROBERT MECHLER
asked on
syntax for passing a parameter to a Python script from IIS html web page
I've set my web app to run a python script that acts as a web api and returns a web page which shows in the browser. Finally got it working but I need to send info about the current logged in user's account to know what to request. The python script is in the root of the web app.
<a href="SampleWeb.py" type="text/html">Sample Holdings</a>
What is the syntax to send a single string parameter.
Would it be like a GET
<a href="SampleWeb.py?acct=9EK2De33" type="text/html">Sample Holdings</a>
Can it be a single value and not a key pair?
On the Python side would it be argv[1] as the receiving variable?
<a href="SampleWeb.py" type="text/html">Sample Holdings</a>
What is the syntax to send a single string parameter.
Would it be like a GET
<a href="SampleWeb.py?acct=9EK2De33" type="text/html">Sample Holdings</a>
Can it be a single value and not a key pair?
On the Python side would it be argv[1] as the receiving variable?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
This method doesn't use a form just an anchor
<a href="PythonScript.py?Name=cxxx-kxxx-xxxxxx" type="text/html">
Could be more than one parameter (key-pair)
Python script to retrieve named parameter
-------------------------------
<a href="PythonScript.py?Name=cxxx-kxxx-xxxxxx" type="text/html">
Could be more than one parameter (key-pair)
Python script to retrieve named parameter
-------------------------------
import cgi
fs = cgi.FieldStorage()
customer = fs['Name'].value
ASKER