All Projects → marshmallow-code → Flask Marshmallow

marshmallow-code / Flask Marshmallow

Licence: mit
Flask + marshmallow for beautiful APIs

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flask Marshmallow

Marshmallow Jsonapi
JSON API 1.0 (https://jsonapi.org/) formatting with marshmallow
Stars: ✭ 203 (-69.52%)
Mutual labels:  rest-api, marshmallow, flask
Flask Smorest
DB agnostic framework to build auto-documented REST APIs with Flask and marshmallow
Stars: ✭ 317 (-52.4%)
Mutual labels:  rest-api, marshmallow, flask
Safrs
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI
Stars: ✭ 255 (-61.71%)
Mutual labels:  rest-api, sqlalchemy, flask
Flask Restplus Server Example
Real-life RESTful server example on Flask-RESTplus
Stars: ✭ 1,240 (+86.19%)
Mutual labels:  rest-api, marshmallow, flask
Hobbit Core
A flask project generator.
Stars: ✭ 49 (-92.64%)
Mutual labels:  marshmallow, sqlalchemy, flask
Python Api Development Fundamentals
Develop a full-stack web application with Python and Flask
Stars: ✭ 44 (-93.39%)
Mutual labels:  marshmallow, sqlalchemy, flask
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+324.17%)
Mutual labels:  rest-api, marshmallow, flask
Full Stack
Full stack, modern web application generator. Using Flask, PostgreSQL DB, Docker, Swagger, automatic HTTPS and more.
Stars: ✭ 451 (-32.28%)
Mutual labels:  marshmallow, sqlalchemy, flask
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+24.77%)
Mutual labels:  rest-api, marshmallow, flask
Flask Rest Jsonapi
Flask extension to build REST APIs around JSONAPI 1.0 specification.
Stars: ✭ 566 (-15.02%)
Mutual labels:  marshmallow, sqlalchemy, flask
flask-rest-api
This program shows how to set up a flaskrestapi with postgre db, blueprint, sqlalchemy, marshmallow, wsgi, unittests
Stars: ✭ 28 (-95.8%)
Mutual labels:  sqlalchemy, marshmallow
Quora Api
An unofficial API for Quora.
Stars: ✭ 250 (-62.46%)
Mutual labels:  rest-api, flask
Deep Learning In Production
In this repository, I will share some useful notes and references about deploying deep learning-based models in production.
Stars: ✭ 3,104 (+366.07%)
Mutual labels:  rest-api, flask
Flask Appbuilder
Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
Stars: ✭ 3,603 (+440.99%)
Mutual labels:  rest-api, flask
Flask Sqlacodegen
🍶 Automatic model code generator for SQLAlchemy with Flask support
Stars: ✭ 283 (-57.51%)
Mutual labels:  sqlalchemy, flask
Flask Sqlalchemy
Adds SQLAlchemy support to Flask
Stars: ✭ 3,658 (+449.25%)
Mutual labels:  sqlalchemy, flask
Enferno
A Python framework based on Flask microframework, with batteries included, and best practices in mind.
Stars: ✭ 385 (-42.19%)
Mutual labels:  sqlalchemy, flask
Data Driven Web Apps With Flask
Course demo code and other hand-out materials for our data-driven web apps in Flask course
Stars: ✭ 388 (-41.74%)
Mutual labels:  sqlalchemy, flask
Mini Shop Server
基于 Flask 框架开发的微信小程序后端项目,用于构建小程序商城后台 (电商相关;rbac权限管理;附带自动生成Swagger 风格的API 文档;可作「Python 项目毕设」;慕课网系列)---- 相关博客链接:🌟
Stars: ✭ 446 (-33.03%)
Mutual labels:  sqlalchemy, flask
Flask Restplus Boilerplate
A boilerplate for flask restful web service
Stars: ✭ 466 (-30.03%)
Mutual labels:  sqlalchemy, flask

Flask-Marshmallow


|pypi-package| |build-status| |docs| |marshmallow3| |black|

Flask + marshmallow for beautiful APIs

Flask-Marshmallow is a thin integration layer for Flask_ (a Python web framework) and marshmallow_ (an object serialization/deserialization library) that adds additional features to marshmallow, including URL and Hyperlinks fields for HATEOAS-ready APIs. It also (optionally) integrates with Flask-SQLAlchemy <http://flask-sqlalchemy.pocoo.org/>_.

Get it now

::

pip install flask-marshmallow

Create your app.

.. code-block:: python

from flask import Flask
from flask_marshmallow import Marshmallow

app = Flask(__name__)
ma = Marshmallow(app)

Write your models.

.. code-block:: python

from your_orm import Model, Column, Integer, String, DateTime


class User(Model):
    email = Column(String)
    password = Column(String)
    date_created = Column(DateTime, auto_now_add=True)

Define your output format with marshmallow.

.. code-block:: python

class UserSchema(ma.Schema):
    class Meta:
        # Fields to expose
        fields = ("email", "date_created", "_links")

    # Smart hyperlinking
    _links = ma.Hyperlinks(
        {
            "self": ma.URLFor("user_detail", values=dict(id="<id>")),
            "collection": ma.URLFor("users"),
        }
    )


user_schema = UserSchema()
users_schema = UserSchema(many=True)

Output the data in your views.

.. code-block:: python

@app.route("/api/users/")
def users():
    all_users = User.all()
    return users_schema.dump(all_users)


@app.route("/api/users/<id>")
def user_detail(id):
    user = User.get(id)
    return user_schema.dump(user)


# {
#     "email": "[email protected]",
#     "date_created": "Fri, 25 Apr 2014 06:02:56 -0000",
#     "_links": {
#         "self": "/api/users/42",
#         "collection": "/api/users/"
#     }
# }

http://flask-marshmallow.readthedocs.io/

Learn More

To learn more about marshmallow, check out its docs <http://marshmallow.readthedocs.io/en/latest/>_.

Project Links

License

MIT licensed. See the bundled LICENSE <https://github.com/marshmallow-code/flask-marshmallow/blob/master/LICENSE>_ file for more details.

.. _Flask: http://flask.pocoo.org .. _marshmallow: http://marshmallow.readthedocs.io

.. |pypi-package| image:: https://badgen.net/pypi/v/flask-marshmallow :target: https://pypi.org/project/flask-marshmallow/ :alt: Latest version .. |build-status| image:: https://dev.azure.com/sloria/sloria/_apis/build/status/marshmallow-code.flask-marshmallow?branchName=dev :target: https://dev.azure.com/sloria/sloria/_build/latest?definitionId=14&branchName=dev :alt: Build status .. |docs| image:: https://readthedocs.org/projects/flask-marshmallow/badge/ :target: https://flask-marshmallow.readthedocs.io/ :alt: Documentation .. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3 :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html :alt: marshmallow 3 compatible .. |black| image:: https://badgen.net/badge/code%20style/black/000 :target: https://github.com/ambv/black :alt: code style: black

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].