首页
注册
登录
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
V2EX
›
Python
利用 OpenAPI Schema 生成 Python 客户端,但是遭遇 CSRF 问题
nowheremanx
·
2024-03-02 13:01:55 +08:00
via iPhone · 1066 次点击
这是一个创建于 369 天前的主题,其中的信息可能已经有所发展或是发生改变。
前端 Vue3 ,后端 Django 。所有 API 都是通过 cookie 中的 oauth token 在后端确定访问权限的。
目前后端系统直接根据 schema 生成前端 TS 的客户端,写前端的时候直接有 API 定义,加速了项目进行。
现在想要利用 schema 生成 Python 客户端,这样就能用脚本和后端互动了,但是目前遭遇了 CSRF 缺失的问题。 当然可以在后端直接 exempt 掉 CSRF ,但是看网上讨论这是有网络安全风险的。
但是网上能 POST 的客户端一大堆,他们都是怎么做的呢?过来请教一下
schema
CSRF
客户端
Python
2 条回复
•
2024-03-02 23:10:53 +08:00
1
ruanimal
2024-03-02 21:02:20 +08:00
https://pypi.org/project/django-cors-headers/
2
nowheremanx
OP
2024-03-02 23:10:53 +08:00 via iPhone
@
ruanimal
这不是 CORS 的问题呀
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
5261 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 35ms ·
UTC 08:04
·
PVG 16:04
·
LAX 00:04
·
JFK 03:04
Developed with
CodeLauncher
♥ Do have faith in what you're doing.