simple cgi 'system'?

G

gabor

hi,

i'm developing an application which many times downloads differents
stuff from http.

for this i'd need a quick way to create a cgi to for example return
always error 503. so that i can test my program if it handles this error
correctly or not.

because the program is in java, i usually create a small servlet, but i
thought that maybe python would be easier.

what is the easiest way to create a cgi?
i know about the cgi module, but most of times i need something a little
higher level.

usually i only want to specify for example that the cgi should fail with
error 503, i don't want to print all the header stuff manually.

any ideas?

gabor
 
A

Andrew Clover

gabor said:
i know about the cgi module, but most of times i need something a little
higher level.

The cgi module is slightly mis-named. It's for reading in HTML form
submissions. You don't need to use it to write a CGI script if you're
just going to return a 503 anyway.

The 'print all the header stuff manually' solution:

#!/path/to/python
print 'Status: 503 Service Unavailable'
print

There isn't a particular module to simplify writing this sort of script
as it is already completely trivial!
 

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,183
Messages
2,570,967
Members
47,517
Latest member
Andres38A1

Latest Threads

Top