V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2021-06-29 00:05:57 +08:00 · 2180 次点击
    这是一个创建于 1024 天前的主题,其中的信息可能已经有所发展或是发生改变。
    类似于 drf 中的 serializer. 或者类似于 pydantic
    我记着 flask 的 restful 插件里面有一个 schema 的概念, 但是记不得插件的名字了. 搜了半天也没搜到.

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

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


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

    eve 没用过。APIFlask 好像还比较新,不确定能不能生产使用。
    RRRoger
        5
    RRRoger  
       2021-06-29 09:49:54 +08:00
    SmartKeyerror
        6
    SmartKeyerror  
       2021-06-29 10:46:11 +08:00
    @CharAct3 marshmallow +1,我也觉得挺好用的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3042 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 14:57 · PVG 22:57 · LAX 07:57 · JFK 10:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.