Skip to main content

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

Download files

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

Files for nanohttp, version 0.1.0.dev0
Filename, size File type Python version Upload date Hashes
Filename, size nanohttp-0.1.0.dev0-py3-none-any.whl (7.7 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size nanohttp-0.1.0.dev0.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page