Skip to content
Dawid Kraczkowski edited this page Mar 24, 2021 · 11 revisions

Chocs is a modern HTTP framework for building AWS HTTP API/REST API and WSGI compatible applications. Chocs aims to be small, expressive, and robust. It provides an elegant API for writing fault-proof, extensible microservices.

Features

  • AWS Serverless integration
  • Open api integration
  • Elegant and easy API
  • No additional bloat like built-in template engines, session handlers, etc.
  • Compatible with all WSGI servers
  • Loosely coupled components which can be used separately
  • Multipart body parsing
  • Graceful error handling
  • HTTP middleware support
  • Fast routing
  • CLI tool to support your daily tasks

Requirements

  • Python version 3.7 or better.

  • Optional bjoern package for using chocs.serve function.

Installation

With pip

pip install chocs

or poetry

poetry add chocs

Quick start

import chocs

http = chocs.Application()

@http.get("/hello/{name}")
def hello(request: chocs.HttpRequest) -> chocs.HttpResponse:
    return chocs.HttpResponse(f"Hello {request.path_parameters.get('name')}!")

chocs.serve(http)

Keep in mind that the serve() function is using the bjoern package, so make sure you included it in your project dependencies before using it. You are able to use any WSGI compatible server.