Skip to main content

A really lightweight and simple API server, built on the socketserver module

Project description

Meager

Meager is a tiny web framework built on the socketserver module in Python.

Codacy Badge Build Status Python Versions

Installation

Meager is available on PyPI.

You can install meager using pip: pip install meager

Examples

This is the simplest way of using meager, returning html upon a request to "/".

The module is heavily inspired by flask, and it's ease of use, and readability.

Example returning html

import meager
app = meager.Server(host="0.0.0.0", port=8080) # Set binding ip address and port, default is localhost:2090

@app.router.route("/")
def index(request):
    return "<h1>Hello world!</h1>"
app.serve()

Example returning JSON

import meager
app = meager.Server()
example_dict = {"key1": "val1", "key2": "val2"}

@app.router.route("/")
def index(request):
    return example_dict # It can detect if you're sending a dictionary
                        # and automatically changes the "Content-Type:" header to application/json 
app.serve()

Project details


Download files

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

Files for meager, version 0.1.8
Filename, size & hash File type Python version Upload date
meager-0.1.8.tar.gz (3.1 kB) View hashes Source None

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