simple cgi 'system'?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gabor

    simple cgi 'system'?

    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


  • Andrew Clover

    #2
    Re: simple cgi 'system'?

    gabor <gabor@z10n.net > wrote:
    [color=blue]
    > i know about the cgi module, but most of times i need something a little
    > higher level.[/color]

    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!

    --
    Andrew Clover
    mailto:and@doxd esk.com

    Comment

    Working...