```python
from pycnic.core import WSGI, Handler
class Hello(Handler): def get(self, name="World"): return { "message":"Hello, %s!"%(name) }
class app(WSGI): routes = [ ('/', Hello()), ('/([\w]+)', Hello()) ] ```
Now that Pycnic is available on PyPI, it may be installed with pip.
pip install pycnic
Pycnic may be ran with any WSGI-compliant server, such as Gunicorn.
gunicorn file:app
This release isn't anything special, but here are the key changes.
- The handler's before
method is no longer called on 404's.
- If debug = True
now properly returns indented, readable JSON for all JSON responses.
Contains a few optimizations and features added by @felixbuenemann.
Notably:
1. request.get_header('name', default=None)
2. Better caching of request object fields, such as data
and cookies
.
3. Many more supported HTTP statuses.
Also includes the ability to parse QUERY_STRING in requests.
Example:
- self.request.args
- Dictionary of parameters.
- self.request.json_args
- A json object passed via QUERY_STRING inside json=
.