Skip to content

bliepp/bottle-restx

Repository files navigation

Bottle RESTX

A simple resource based REST API extension for the bottle framework. Loosely inspired by flask-restx.

Installation

Via pip

$ pip install bottle-restx

Quickstart

The syntax is class based. Create an API object, which is a subclass of bottle.Bottle. For every resource add a subclass of the Resource class and decorate it with the API.route decorator. The route is passed to the method fitting the HTTP method.

from bottle_restx import API, Resource
api = API()

@api.route("/my/route/<id>")
class MyResource(Resource):
    def get(self, id):
    ...
    def post(self, id):
    ...
    def put(self, id):
    ...
    def delete(self, id):
    ...

The individual methods are not mandatory. You might actually discard unwanted methods. By default they produce an 405 (Method not allowed).

About

A simple resource based REST API extension for the bottle framework. Loosely inspired by flask-restx.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages