Link to home
Start Free TrialLog in
Avatar of ROBERT MECHLER
ROBERT MECHLERFlag for United States of America

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?





ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ROBERT MECHLER

ASKER

Question fully answered. Thanks
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
-------------------------------
import cgi
fs = cgi.FieldStorage()
customer = fs['Name'].value

Open in new window