python requests 模拟登陆战网失败,pythonrequests,想自己写一个守望先锋查看
python requests 模拟登陆战网失败,pythonrequests,想自己写一个守望先锋查看
想自己写一个守望先锋查看生涯数据的脚本
不知缺少什么东西,post后200,但是登陆数据显示未登录
# coding: utf-8import requestsclass Career(object): def __init__(self): self.login_url = 'https://www.battlenet.com.cn/login/zh/?ref=https://www.battlenet.com.cn/oauth/authorize?client_id%3Dnetease-sc2-esports%26response_type%3Dcode%26scope%3Did%2Bbattletag%2Blogout%2Bprofile%2Bprivate_games%26redirect_uri%3Dhttps%253A%252F%252Faccount.bnet.163.com%252Fbattlenet%252Flogin%253Finner_client_id%253Dow%2526inner_redirect_uri%253Dhttp%25253A%25252F%25252Fow.blizzard.cn%25252Fbattlenet%25252Flogin%25253Fredirect_url%25253Dhttp%2525253A%2525252F%2525252Fow.blizzard.cn%2525252Fcareer%2525252F&app=oauth' self.career_url = 'http://ow.blizzard.cn/career/' self.headsers = { 'Host': 'www.battlenet.com.cn', 'Connection': 'keep-alive', 'Cache-Control': 'max-age=0', 'Origin': 'https://www.battlenet.com.cn', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'DNT': '1', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'zh-CN,en-US;q=0.8,en;q=0.6,zh;q=0.4' } self.form_data = { 'accountName': '***', 'password': '***', } def login(self): session = requests.session() session.headers = self.headsers a = session.post(url=self.login_url, data=self.form_data) html = session.get(url=self.career_url) print(html.text)instance = Career()instance.login()
Form_Data里的信息有不少呢,看看是不是因为这个。
这样呢?
def login(self): session = requests.session() session.headers.update(self.headsers) a = session.post(url=self.login_url, data=self.form_data) html = session.get(url=self.career_url) print(html.text)
编橙之家文章,
相关内容
- Python urllib.openurl()不定时会抛出异常是什么情况.,,异常
- 关于python类使用顺序问题的疑惑,python类顺序疑惑,dj
- Python str函数与repr函数两都有何不同,pythonrepr,这两个函
- Ubuntu下编译Vim8(python)无数次编译失败,ubuntuvim8,因为
- pymongo 读取集合关联外键文档字段用什么方法,pymongo字
- Python sqlalchemy下面的查询效率如何优化,pythonsqlalchemy
- Python multithreading.Pool多线程bug3770是什么情况,,使用py
- 求分析django工程目录里找不到导入模块原因,django模块
- python高手来说说list和tuple及dict区别在哪里,什么时候用
- Python求直线上一个点用什么方法,Python一个点方法,在一
评论关闭