推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
chaleaoch
V2EX  ›  Python

如何对 flask api 的接口做校验?

  •  
  •   chaleaoch · Jun 29, 2021 · 3604 views
    This topic created in 1918 days ago, the information mentioned may be changed or developed.
    类似于 drf 中的 serializer. 或者类似于 pydantic
    我记着 flask 的 restful 插件里面有一个 schema 的概念, 但是记不得插件的名字了. 搜了半天也没搜到.

    然后 现在 flask 的 rest api 插件 活的好的就是 flask-restful 了吧?

    在然后 eve 是个啥? 感觉有点重啊. 和 flask 的设计理念是不是 不很兼容? 请大佬赐教一下理论.


    一共三个问题, 谢谢大佬们.
    6 replies  •  2021-06-29 10:46:11 +08:00
    CharAct3
        1
    CharAct3  
       Jun 29, 2021   ❤️ 1
    1. 可以使用 marshmallow
    2. 可以试试 https://github.com/greyli/apiflask,这个也是使用的 marshmallow
    3. 看了一下 eve,应该是个用 flask 和 ceberus 封装的 RESTful 框架
    mongodb
        2
    mongodb  
       Jun 29, 2021   ❤️ 1
    wzw
        3
    wzw  
       Jun 29, 2021 via iPhone   ❤️ 1
    我直接还 go
    Kobayashi
        4
    Kobayashi  
       Jun 29, 2021 via Android   ❤️ 1
    Webargs + Flask-apispec. FastAPI 作者之前用的是这套组合。https://fastapi.tiangolo.com/alternatives/#flask-apispec

    eve 没用过。APIFlask 好像还比较新,不确定能不能生产使用。
    RRRoger
        5
    RRRoger  
       Jun 29, 2021
    SmartKeyerror
        6
    SmartKeyerror  
       Jun 29, 2021
    @CharAct3 marshmallow +1,我也觉得挺好用的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2605 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 15:27 · PVG 23:27 · LAX 08:27 · JFK 11:27
    ♥ Do have faith in what you're doing.