flask-api alternatives and similar packages
Based on the "Flask" category.
Alternatively, view flask-api alternatives based on common mentions on social networks and blogs.
-
Flask RestPlus
Fully featured framework for fast, easy and documented API development with Flask -
pycord
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API -
flask-restless
NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models. -
apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification).. -
Flask Google Maps
Easy way to add GoogleMaps to Flask applications. maintainer: @getcake -
PEP 8 Speaks
A GitHub :octocat: app to automatically review Python code style over Pull Requests -
flask_for_startups
Flask boilerplate using a services oriented structure -
Flask-Diamond
:gem: Flask-Diamond is a batteries-included Flask framework. -
discord-interactions-python
Useful tools for building interactions in Python -
#<Sawyer::Resource:0x00007f160f191eb0>
Python package for webscraping in Natural language -
Cilantropy
:four_leaf_clover: Cilantropy is a Python Package Manager interface created to provide an "easy-to-use" visual and also a command-line interface for Pythonistas. Works great on windows, linux, macos :star: -
flask-api-utils
Flask extension that takes care of API representation and authentication. -
Flask-FileAlchemy
YAML-formatted plain-text file based models for Flask backed by Flask-SQLAlchemy -
flask-ripozo
A python package for integrating ripozo with Flask -
Burrowkv
Burrowkv is a simple key-value store implementation in Python -
Apprentice
Built for streamlining development of Google Assistant Actions -
Flask-RESTX-boilerplate
The boilerplate for the project using restful Flask-RESTX framework
TestGPT | Generating meaningful tests for busy devs
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of flask-api or a related project?
README
Flask API
Browsable web APIs for Flask.
Status: This project is in maintenance mode. The original author (Tom Christie) has shifted his focus to API Star. Passing PRs will still be considered for releases by the maintainer (Jace Browning).
Overview
Flask API is a drop-in replacement for Flask that provides an implementation of browsable APIs similar to what Django REST framework offers. It gives you properly content-negotiated responses and smart request parsing:
[Screenshot](docs/screenshot.png)
Installation
Requirements:
- Python 3.6+
- Flask 1.1.+
Install using pip
:
$ pip install Flask-API
Import and initialize your application:
from flask_api import FlaskAPI
app = FlaskAPI(__name__)
Responses
Return any valid response object as normal, or return a list
or dict
.
@app.route('/example/')
def example():
return {'hello': 'world'}
A renderer for the response data will be selected using content negotiation based on the client 'Accept' header. If you're making the API request from a regular client, this will default to a JSON response. If you're viewing the API in a browser, it'll default to the browsable API HTML.
Requests
Access the parsed request data using request.data
. This will handle JSON or form data by default.
@app.route('/example/')
def example():
return {'request data': request.data}
Example
The following example demonstrates a simple API for creating, listing, updating and deleting notes.
from flask import request, url_for
from flask_api import FlaskAPI, status, exceptions
app = FlaskAPI(__name__)
notes = {
0: 'do the shopping',
1: 'build the codez',
2: 'paint the door',
}
def note_repr(key):
return {
'url': request.host_url.rstrip('/') + url_for('notes_detail', key=key),
'text': notes[key]
}
@app.route("/", methods=['GET', 'POST'])
def notes_list():
"""
List or create notes.
"""
if request.method == 'POST':
note = str(request.data.get('text', ''))
idx = max(notes.keys()) + 1
notes[idx] = note
return note_repr(idx), status.HTTP_201_CREATED
# request.method == 'GET'
return [note_repr(idx) for idx in sorted(notes.keys())]
@app.route("/<int:key>/", methods=['GET', 'PUT', 'DELETE'])
def notes_detail(key):
"""
Retrieve, update or delete note instances.
"""
if request.method == 'PUT':
note = str(request.data.get('text', ''))
notes[key] = note
return note_repr(key)
elif request.method == 'DELETE':
notes.pop(key, None)
return '', status.HTTP_204_NO_CONTENT
# request.method == 'GET'
if key not in notes:
raise exceptions.NotFound()
return note_repr(key)
if __name__ == "__main__":
app.run(debug=True)
Now run the webapp:
$ python ./example.py
* Running on http://127.0.0.1:5000/
* Restarting with reloader
You can now open a new tab and interact with the API from the command line:
$ curl -X GET http://127.0.0.1:5000/
[{"url": "http://127.0.0.1:5000/0/", "text": "do the shopping"},
{"url": "http://127.0.0.1:5000/1/", "text": "build the codez"},
{"url": "http://127.0.0.1:5000/2/", "text": "paint the door"}]
$ curl -X GET http://127.0.0.1:5000/1/
{"url": "http://127.0.0.1:5000/1/", "text": "build the codez"}
$ curl -X PUT http://127.0.0.1:5000/1/ -d text="flask api is teh awesomez"
{"url": "http://127.0.0.1:5000/1/", "text": "flask api is teh awesomez"}
You can also work on the API directly in your browser, by opening http://127.0.0.1:5000/. You can then navigate between notes, and make GET
, PUT
, POST
and DELETE
API requests.