Skip to main content

Extremely simple Python CGI framework for Apache 2.

Project description

Python CGI

version license pyversions
donate powered made

Extremely simple Python CGI framework for Apache 2.

Hierarchy

pythoncgi
|---- _SERVER
|---- _GET
|---- _POST
|---- _SESSION
|---- _COOKIE
|---- _HEADERS
|---- set_status()
|---- set_header()
|---- execute()
|---- print()
|---- main()
|---- log_construct()
'---- log()

Example

# add .py cgi handler in apache
# allow executecgi in apache
sudo nano index.py
sudo chmod +rwx index.py

###index.py

#!/usr/bin/python3
from pythoncgi import _SERVER, _GET, _POST, _SESSION, _COOKIE, _HEADERS, set_status, set_header, execute, print, main, log_construct, flush


@execute("get")
def get():
    set_status(500)
    set_header("Cache-Control", "max-age=0, must-revalidate")
    print("_SERVER:<br>")
    print(_SERVER)
    print()
    print("_GET:<br>")
    print(_GET)
    print()
    print("_POST:<br>")
    print(_POST)
    print()
    print("_SESSION:<br>")
    print(_SESSION)
    print()
    print("_COOKIE:<br>")
    print(_COOKIE)
    print()
    print("_HEADERS:<br>")
    print(_HEADERS)
    print()
    mylogger = log_construct("mylog.log")
    mylogger("done")


if __name__ == '__main__':
    main()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythoncgi-0.0.16.tar.gz (16.8 kB view hashes)

Uploaded Source

Built Distribution

pythoncgi-0.0.16-py3-none-any.whl (29.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page