A very micro http framework.
Project description
A very micro HTTP framework.
Install
PyPI
$ pip install nanohttp
Source
$ cd path/to/nanohttp
$ pip install -e .
Quick Start
demo.py
from nanohttp import Controller, action, context
class Root(Controller):
@action()
def index(self):
yield from ('%s: %s\n' % i for i in context.environ.items())
$ nanohttp demo
Or
from nanohttp import quickstart
quickstart(Root())
Command Line Interface
$ nanohttp -h
usage: nanohttp [-h] [-c CONFIG_FILE] [-b {HOST:}PORT] [-d DIRECTORY] [-V]
[MODULE{:CLASS}]
positional arguments:
MODULE{:CLASS} The python module and controller class to launch.
default: `nanohttp:Demo`, And the default value for
`:CLASS` is `:Root` if omitted.
optional arguments:
-h, --help show this help message and exit
-c CONFIG_FILE, --config-file CONFIG_FILE
Default: nanohttp.yaml
-b {HOST:}PORT, --bind {HOST:}PORT
Bind Address. default: 8080
-d DIRECTORY, --directory DIRECTORY
The path to search for the python module, which
contains the controller class. default is: `.`
-V, --version Show the version.
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
nanohttp-0.1.0.dev0.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for nanohttp-0.1.0.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 950bd6a1c67669a7aa7ac90681c511f62ec22122cd9804d98bba00f17f4008c1 |
|
MD5 | b77187817ab3775e88b44fba3162f1bc |
|
BLAKE2b-256 | e8ec3d6742bf54e6f38b39b8267be8302f179fd9c5e3c44d46f5abf4bc14b5fb |