python-3.x - 无法在 kaggle 网站中使用 request.post 登录
问题描述
当我调用获取请求时,是否有任何具体原因无法找到authenticity_token。我尝试了很多方法,但 kaggle 不允许我使用脚本登录。
这是我的示例代码:
#url for tain file
url='https://www.kaggle.com/c/titanic/download/train.csv'
#setup session
headers={"Content-Type":"application/x-www-form-
urlencoded","Host":"www.kaggle.com","Origin":"https://www.kaggle.com"\
,"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106
Safari/537.36"}
with session() as c:
b=c.get('https://www.kaggle.com/account/login',headers=headers)
print(b.text) #***not able to find authenticity_token here***
解决方案
嗯,你试过Kaggle API吗?您可能会发现它更易于使用。
推荐阅读
- arrays - 有没有办法创建一个数组属性,里面有很多 mongoDB objectiID
- python - 如果存在任何 np.nan,则删除数据帧字典中的所有数据帧
- python - 在 Windows 的 Linux 子系统上从 Selenium 启动 Chrome 时遇到问题
- c# - WinDbg !dumpmodule 看不到所有类
- python - 目标 WSGI 脚本 myapp.wsgi' 无法作为 Python 模块加载,ModuleNotFoundError: No module named 'flask'
- android - 滚动视图不起作用...滚动视图仅在屏幕的一半中起作用
- c++ - 如何使用mysql的内部头文件?
- r - 如何使用 apply(lapply、mapply 等)函数加速这个 R 代码?
- python - 在 Google 的 ortools 中更改车辆路径问题的目标函数
- java - 如何在 maven-compiler-plugin 中显示编译进度?