Skip to main content

HTTP REST library including OOP-readiness and Open-API generation

Project description

https://readthedocs.org/projects/restit/badge/?version=latest https://coveralls.io/repos/github/Rollmops/restit/badge.svg?branch=master https://github.com/Rollmops/restit/workflows/Python%20package/badge.svg

Python HTTP REST library including OOP-readiness and Open-API generation

For a more comprehensive documentation see: https://restit.readthedocs.io/en/latest/

Features

  • WSGI conform
  • Validation (using marshmallow)
    • query parameter validation
    • path parameter validation
    • request body validation
    • response body validation
  • OpenApi documentation generation
  • OOP-ready (no module-based global instances necessary)
  • Easy hyperlink generation
  • Easy to test

Quick example

from restit import Request, Resource, Response, RestItApp
from restit.decorator import path


@path("/")
class IndexResource(Resource):
    def get(self, request: Request) -> Response:
        return Response("Hello from index.")


app = RestItApp(resources=[IndexResource()])


if __name__ == "__main__":
    # start a development server on http://127.0.0.1:5000
    app.start_development_server()

You can also use a production-ready server like Gunicorn (given the name of the above module is restit_app_test.py):

gunicorn -w 4 restit_app_test:app

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 restit, version 0.2.6
Filename, size File type Python version Upload date Hashes
Filename, size restit-0.2.6-py3-none-any.whl (2.6 MB) File type Wheel Python version py3 Upload date Hashes View
Filename, size restit-0.2.6.tar.gz (2.5 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page