| Name | cgiw JSON |
| Version |
0.2.3
JSON |
| download |
| home_page | None |
| Summary | A framework for building python cgi scripts |
| upload_time | 2024-08-21 19:41:42 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.7 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# 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.
```python
#!/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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "cgiw",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "James Rao <jamesnarayanrao@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d1/62/e7b0165d474061020258336f7e6d6147992f4bda14807b707e6712a2f23e/cgiw-0.2.3.tar.gz",
"platform": null,
"description": "# CGI Wrapper\n\nThis is a lightweight, extensible framework for writing CGI scripts in python.\n\n## Install\n\n```\npip install cgiw\n```\n\n## Use \n\nThis 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.\n\n### Example\nHere is an example that demonstrates the functionality of the framework.\n\n```python\n#!/bin/python3\n\nfrom cgiw import run\nfrom cgiw.responses import redirect\nfrom cgiw.decorators import wrap_headers, wrap_body \n\n\ndef process_headers(headers):\n # do stuff\n return headers\n\ndef process_body(body):\n # do stuff\n return body\n\n@wrap_headers(process_headers)\n@wrap_body(process_body)\ndef handler(query, headers, body):\n # do stuff\n return redirect('/test', {'query': 'string'})\n\nrun(post=handler)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A framework for building python cgi scripts",
"version": "0.2.3",
"project_urls": {
"Bug Tracker": "https://github.com/JamesRao98/cgiw/issues",
"Homepage": "https://github.com/JamesRao98/cgiw"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "06dc220097f237cd0d2ecd3c43850036627049fca63b7c0a7a3dc055d045db93",
"md5": "d06964ae0399a5b566a2e2360ec521ec",
"sha256": "3b90e747e1b7a2e43b712205dc69238fb143cb57835af78a3e5950b8ac1a4363"
},
"downloads": -1,
"filename": "cgiw-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d06964ae0399a5b566a2e2360ec521ec",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 19187,
"upload_time": "2024-08-21T19:41:41",
"upload_time_iso_8601": "2024-08-21T19:41:41.095763Z",
"url": "https://files.pythonhosted.org/packages/06/dc/220097f237cd0d2ecd3c43850036627049fca63b7c0a7a3dc055d045db93/cgiw-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d162e7b0165d474061020258336f7e6d6147992f4bda14807b707e6712a2f23e",
"md5": "9199f37f088bbcb673f4b5e12ccdd53b",
"sha256": "62f784e3255edea37d60d8e3fcab955107b2f159f57cbebfb2cb147892b5f549"
},
"downloads": -1,
"filename": "cgiw-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "9199f37f088bbcb673f4b5e12ccdd53b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 19600,
"upload_time": "2024-08-21T19:41:42",
"upload_time_iso_8601": "2024-08-21T19:41:42.901420Z",
"url": "https://files.pythonhosted.org/packages/d1/62/e7b0165d474061020258336f7e6d6147992f4bda14807b707e6712a2f23e/cgiw-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-21 19:41:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JamesRao98",
"github_project": "cgiw",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cgiw"
}