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 | 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)

Uploaded Source

Built Distribution

nanohttp-0.1.0.dev0-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page