python - Can't login with python post错误出现
问题描述
当我尝试使用请求登录 GameStop(gamestop.ca) 时,这就是我得到的。我做错了什么或我错过了什么?我尝试添加许多其他标头,包括网络下 chrome dev 工具中显示的权限标头。我不明白为什么这不起作用,但是当我尝试使用 selenium 登录时 selenium 起作用。如果这是因为机器人检测,那么硒不应该更容易检测到吗?
import requests
import json
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'}
payload = {
'UserName': '*****',
'Password': '******',
'RememberMe': 'false'
}
with requests.session() as s:
r = s.post('https://www.gamestop.ca/Account/LogOn', headers=headers, data=payload)
print(r.status_code)
print(r.content)
print(r.text)
403
b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http://www.gamestop.ca/Account/LogOn" on this server.<P>\nReference #18.70fd017.1635453520.211da9c5\n</BODY>\n</HTML>\n'
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://www.gamestop.ca/Account/LogOn" on this server.<P>
Reference #18.70fd017.1635453520.211da9c5
</BODY>
</HTML>
解决方案
推荐阅读
- c++ - 为什么它是使用 GCC 的模棱两可的函数调用?模板扣除失败?
- django - 使用实例编辑 django 表单总是加载空表单字段
- wordpress - wordpress 网站上上传的图片未显示在移动设备上
- css - 动画名称属性中的“足够”和“太多”值是什么意思?
- sql-server - 将 CAST、CONCAT 和 COLLATE 与 LEFT OUTER JOIN 结合使用
- node.js - Angular 7 e2e 连接 ETIMEDOUT,无法建立隧道套接字
- java - restAssured 发送请求的两种方式有什么区别?
- c# - 在 WPF MVVM 应用程序中的多个 ViewModel 之间传递图像/数据
- php - 如何将数字的字符串值转换为锚标签内的电话格式?
- python - 如何在正则表达式中为一组条件定义量词?