473,385 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Python CGI: how to retrieve variables passed by URL

If I go to my cgi python script with
localhost/cgi-bin/script-name.cgi?variable=value

How do I gather this value?

Thanks in advance.
Jul 18 '05 #1
2 1974
This may help, but not sure if there is a better, built in way.

print os.environ["QUERY_STRING"].split("=")[1]

prints value if I use localhost/cgi-bin/script-name.cgi?variable=value and
this will work... but is there a better way?

"Sean Berry" <se********@cox.net> wrote in message
news:hU1ic.86730$U83.37750@fed1read03...
If I go to my cgi python script with
localhost/cgi-bin/script-name.cgi?variable=value

How do I gather this value?

Thanks in advance.

Jul 18 '05 #2
Am Freitag 23 April 2004 07:42 schrieb Sean Berry:
print os.environ["QUERY_STRING"].split("=")[1]

prints value if I use localhost/cgi-bin/script-name.cgi?variable=value and
this will work... but is there a better way?


Start python, and type import cgi and then help(cgi). The cgi module should
take care of what you need perfectly. If the docstrings aren't enough to get
you started, go to www.python.org -> Documentation -> Global Module Index and
check the documentation of the cgi module there.

HTH!

Heiko.

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DeepBleu | last post by:
When one is using an HTML form via a web broswer, the user submits the form contents and these are passed to a CGI Python script on the web server. I need to write a client script that connects to...
4
by: sean | last post by:
I tried getting mod_python to work but have had lots of problems getting it running. So, I have settled on using python cgi. I have already got it going and it seems to run fast enough for me. ...
1
by: Casey Bralla | last post by:
I've got a python cgi-bin application which produces an apache web page. I want to pass arguments to it on the URL line, but the parameters are not getting passed along to python properly. I've...
2
by: Samuel | last post by:
Hi, I have the following form: <form action="?one=1" method="post"> <input type="hidden" name="two" value="2" /> </form> and would like to retrieve both fields, "one" and "two". However,...
1
by: vikjohn | last post by:
I have a new perl script sent to me which is a revision of the one I am currently running. The permissions are the same on each, the paths are correct but I am getting the infamous : The specified...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.