Skip to main content

A small wrapper for flask app to ease the endpoints creation

Project description

A small wrapper for a Flask app to simplify endpoints creation

Motivation

At my company, we’ve been using Flask-RESTful for a lot of projects for the past couple of years, and when we mapped exactly what we need from it, it was mostly the way it allows the user to add routing.

This small module replace for us this functionality, so I’ve decided to share it with whoever want to give it a try :wink:

Getting Started

This wrapper helps davide the Flask App into modules and to use Classes instead of functions for views.

Prerequisites

The only requirement for this project is Flask.

Usage

from flask import Flask
from flask import jsonify
from flask_api_handler import ApiHandler

form example import PaymentHandler

app = Flask(__name__)

# Init the api handler
api = ApiHandler(app)

class UserHandler(object):
    def get(self):
        return jsonify({"user": "user object example"})
    def put(self):
        return jsonify({"user": "update user example"})

# Add the endpoints
api.add_handler('/user', UserHandler)
api.add_handler('/payment', PaymentHandler)

TODO

  • [STRIKEOUT:Make pip installable] - DONE

  • Add tests

Project details


Download files

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

Source Distribution

flask-api-handler-0.1.4.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

flask_api_handler-0.1.4-py2-none-any.whl (4.5 kB view details)

Uploaded Python 2

File details

Details for the file flask-api-handler-0.1.4.tar.gz.

File metadata

File hashes

Hashes for flask-api-handler-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0d329a5cfb32a331e389326cb0932f60a20894dbab455cce70b8b1d5d2d33823
MD5 69c7766e10f3e2d2ec3674793e9c6838
BLAKE2b-256 1bb4628ecb9a8692ce09abfd1a2e0b83bca6204100fc69b1b4623e5cfcc6e1a0

See more details on using hashes here.

File details

Details for the file flask_api_handler-0.1.4-py2-none-any.whl.

File metadata

File hashes

Hashes for flask_api_handler-0.1.4-py2-none-any.whl
Algorithm Hash digest
SHA256 f1a29109ffa3ab1d0ddc4512a3e216ecdb5dcc6294410443da4da6608d7d7ce1
MD5 71008fb83804bdd9955e724a35dbb270
BLAKE2b-256 926b5e9224242110fb02f51dc7da3de6ff69a3adef13638d3f964e2bc9285120

See more details on using hashes here.

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