Skip to main content

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 divide the Flask App into modules and to use Classes instead of functions for views.

Just run pip install and you are good to go:

$ pip install flask-api-handler

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

Release files for flask-api-handler 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-api-handler 0.1.6
File Size Uploaded
flask-api-handler-0.1.6.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-api-handler 0.1.6
File Interpreter ABI Platform
flask_api_handler-0.1.6-py2-none-any.whl Python 2 none any Details

Total release size: 5.7 kB

Release files / flask-api-handler-0.1.6.tar.gz

Download URL flask-api-handler-0.1.6.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cea969dd8079a2ddec3325b08604d420c71970c76e33d5265f711071fa1c74f4
BLAKE2b-256 checksum
How to use checksums
d44931e45f6ba140988ce4a966dc5b198ef8f91f7d4157573512e127ae9326cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / flask_api_handler-0.1.6-py2-none-any.whl

Download URL flask_api_handler-0.1.6-py2-none-any.whl
Size 3.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
cc038a1834af16886ad50f4d08d4797c6103efe6b473fb2bfc9e170949f08dd2
BLAKE2b-256 checksum
How to use checksums
9956da2d7f604607d393342c6a1134b05031566c87922a05008524433f03792c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page