python - 如何发送表单数据的标题
问题描述
我正在尝试登录 Gamestop(gamestop.ca),但它不会让我如下所示。我尝试添加各种标头但没有运气:(..我只是想知道我在发送我的发布请求时是否添加了错误的数据..有人可以确认吗?网络下响应部分中网站的内容类型是:
内容类型:文本/html;字符集=utf-8
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>
ps 我可以使用 selenium 登录,所以我认为该错误不是由机器人保护引起的。
解决方案
推荐阅读
- python - 验证 python 数据类中的详细类型
- blockchain - 无法交易浮动,solidity 智能合约中的分数
- actionscript-3 - Animate ActionScript 3.0 中的按钮超链接
- ios - 清除视图控制器的导航堆栈
- javascript - 计算中位数 JavaScript
- java - 如何将标题文本放在复选框、单选按钮和滑块的左侧?
- angularjs - 如何在angularjs中的exixting数据下方附加json对象
- interpolation - 如何限制插值的最大缺失间隙
- android - 错误:无法解决:可穿戴
- hadoop - spring 应用程序没有从集群中获取 hbase-site.xml