CGI question

D

Dan Stromberg

easily usable for what purpose?

if you want to extract the URL that seems to be hidden in that string,
something like:

url, junk = text.split("\x01", 1)
junk, url = url.split("\\?", 1)

should work.

Um, yeah. I can work out this sort of thing.

But I thought there might be a python module intended for parsing inputs
to CGI scripts? Sometimes using a pre-written module can contend with
issues you didn't know where going to come up...

Thanks!
 
M

Mike Meyer

Dan Stromberg said:
But I thought there might be a python module intended for parsing inputs
to CGI scripts? Sometimes using a pre-written module can contend with
issues you didn't know where going to come up...

Generally, input to CGI scripts are done via the Common Gateway
Interface (CGI). The cgi module does those things. Your example
doesn't look anything like a CGI string, though. Maybe if you told us
where it came from, we could recommend a module for dealing with such.

<mike
 
D

Dan Stromberg

easily usable for what purpose?

if you want to extract the URL that seems to be hidden in that string,
something like:

url, junk = text.split("\x01", 1)
junk, url = url.split("\\?", 1)

should work.

</F>

This is great, but is there no standard python module for taking
apart command line arguments to a CGI script? I'm not eager to reinvent
the wheel, at least not on this project :)
 
F

Fredrik Lundh

Dan said:
This is great, but is there no standard python module for taking
apart command line arguments to a CGI script? I'm not eager to reinvent
the wheel, at least not on this project :)

command-line arguments to CGI scripts?

I'm probably dense, but doesn't CGI scripts usually get their arguments via
environment variables and stdin ? and chr(1) and "hide\?" sure don't look
like standard URL separators to me...

if you want standard CGI argument handling, the "cgi" module contains all
the tools you need.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,271
Messages
2,571,361
Members
48,043
Latest member
BartEaster

Latest Threads

Top