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.
Just run pip install and you are good to go: instructions
$ 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
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
Built Distribution
File details
Details for the file flask-api-handler-0.1.5.tar.gz
.
File metadata
- Download URL: flask-api-handler-0.1.5.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb2626591878775c536fa2651ed44f7d5e94e55bae33aeba30019bdd5e9f6ae |
|
MD5 | 8d39f709fa13a16768e33dd1b3ab14d2 |
|
BLAKE2b-256 | 9d467f7149fe9e47543e7f159ca5999b821deba5ee451728e302d8362cc756f1 |
File details
Details for the file flask_api_handler-0.1.5-py2-none-any.whl
.
File metadata
- Download URL: flask_api_handler-0.1.5-py2-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12af180321e5137399d6f8668a65845457e8f0735bf538e56dfb41c8783fab17 |
|
MD5 | e0334b1f2e52da7a4f64ac4ef9897b70 |
|
BLAKE2b-256 | 579aba10829b108ffd6584f8ae0fa11390696c89473b7c14857a043ba2befe59 |