Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

License

NotificationsYou must be signed in to change notification settings

biosustain/potion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://img.shields.io/travis/biosustain/potion/master.svg?style=flat-squarehttps://img.shields.io/coveralls/biosustain/potion/master.svg?style=flat-squarehttps://img.shields.io/pypi/v/Flask-Potion.svg?style=flat-squarehttps://img.shields.io/pypi/l/Flask-Potion.svg?style=flat-squareJoin the chat at https://gitter.im/biosustain/potion

Flask-Potion

Description

Flask-Potion is a powerful Flask extension for building RESTful JSON APIs.Potion features include validation, model resources and routes, relations, object permissions, filtering, sorting,pagination, signals, and automatic API schema generation.

Potion ships with backends forSQLAlchemy,peewee andMongoEngine models. It is possible to add backends for other data stores, or even to use a subset of Potion without any data store at all.

API client libraries forPython andJavaScript/TypeScript (generic Node as well as AngularJS and Angular) are available.

User's Guide

The user's guide and documentation is published here:

http://potion.readthedocs.org/

Versioning

Potion will use semantic versioning from v1.0.0. Until then, the minor version is used for changes known to be breaking.

Features

  • Powerful API framework both for data-store-linked and plain resources
  • JSON-based and fully self-documenting with JSON Hyper-Schema
  • Backend integrations:
    • Flask-SQLAlchemy
    • Peewee (contributed byMichael Lavers)
    • Flask-MongoEngine
  • Filtering, sorting, pagination, validation, built right in
  • Smart system for handling relations between resources
  • Natural keys for extra simple relation querying
  • Easy-to-use, yet highly flexible, optional permissions system
  • Signals for pre- and post-processing of requests
  • Very customizable — everything is just a resource, route, or schema
  • Access APIs more easily with client libraries forPython andJavaScript/TypeScript

Example(SQLAlchemy)

fromflaskimportFlaskfromflask_sqlalchemyimportSQLAlchemyfromflask_potionimportApi,ModelResource,fieldsfromflask_potion.routesimportItemRouteapp=Flask(__name__)db=SQLAlchemy(app)api=Api(app)classUser(db.Model):id=db.Column(db.Integer,primary_key=True)name=db.Column(db.String(),nullable=False)db.create_all()classUserResource(ModelResource):classMeta:model=User@ItemRoute.GETdefgreeting(self,user)->fields.String():return"Hello, {}!".format(user.name)api.add_resource(UserResource)if__name__=='__main__':app.run()

Authors

Potion is written and maintained byLars Schöning.

Peewee backend support has been contributed byMichael Lavers.

MongoEngine backend support has been contributed byJoão Cardoso.

See here for the full list of contributors.


[8]ページ先頭

©2009-2025 Movatter.jp