CGI Wrapper
This is a lightweight, extensible framework for writing CGI scripts in python.
Install
pip install cgiw
Use
This package takes care of parsing the query, headers and body (if post). It parses some basic mime types such as application/json and application/x-www-form-urlencoded, and allows the developer to use custom parsers. All handlers must return a tuple containing three items: the status string, a dictionary of headers, and the body. There are some basic response functions implemented to avoid having to construct this tuple from scratch.
Example
Here is an example that demonstrates the functionality of the framework.
#!/bin/python3
from cgiw import run
from cgiw.responses import redirect
from cgiw.decorators import wrap_headers, wrap_body
def process_headers(headers):
# do stuff
return headers
def process_body(body):
# do stuff
return body
@wrap_headers(process_headers)
@wrap_body(process_body)
def handler(query, headers, body):
# do stuff
return redirect('/test', {'query': 'string'})
run(post=handler)
Metadata
Release files for cgiw 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cgiw-1.0.5.tar.gz | 19.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cgiw-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.7 kB
Release files / cgiw-1.0.5.tar.gz
| Download URL | cgiw-1.0.5.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3266218fc7e3fe026455bb5f410997b1bc31b43210eb5c3bcda52b5ee82ecdc5
|
|
BLAKE2b-256 checksum How to use checksums |
722a2c54927ef62b6735f11f99f3139fbb523e87a37ee67b9ae624ec485049ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Release files / cgiw-1.0.5-py3-none-any.whl
| Download URL | cgiw-1.0.5-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8850e9d9dc0daf8a773c0721997ee83301e201f4d1e4b43e28d4c9f69954ebb2
|
|
BLAKE2b-256 checksum How to use checksums |
769208c548ce512d26e2ab3b9d786f479ecfc04d7604a73b6f42b970e175ec15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Security for cgiw 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.