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
nowheremanx
V2EX  ›  Python

利用 OpenAPI Schema 生成 Python 客户端,但是遭遇 CSRF 问题

  •  
  •   nowheremanx · 56 天前 via iPhone · 781 次点击
    这是一个创建于 56 天前的主题,其中的信息可能已经有所发展或是发生改变。
    前端 Vue3 ,后端 Django 。所有 API 都是通过 cookie 中的 oauth token 在后端确定访问权限的。

    目前后端系统直接根据 schema 生成前端 TS 的客户端,写前端的时候直接有 API 定义,加速了项目进行。


    现在想要利用 schema 生成 Python 客户端,这样就能用脚本和后端互动了,但是目前遭遇了 CSRF 缺失的问题。 当然可以在后端直接 exempt 掉 CSRF ,但是看网上讨论这是有网络安全风险的。

    但是网上能 POST 的客户端一大堆,他们都是怎么做的呢?过来请教一下
    2 条回复    2024-03-02 23:10:53 +08:00
    nowheremanx
        2
    nowheremanx  
    OP
       56 天前 via iPhone
    @ruanimal 这不是 CORS 的问题呀
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1583 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:46 · PVG 00:46 · LAX 09:46 · JFK 12:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.