Using python requests library to login to website

穿精又带淫゛_ 提交于 2019-11-29 08:01:38

@DanAlbert pointed out that I was telling you to use HTTP Auth which isn't what you're trying to do. I assumed since everything looked correct that it might just be HTTP Auth that you needed.

However, looking at the form it looks like maybe you're just using the wrong variable name in your dict:

import requests
s = requests.session()
login_data = dict(email='email', password='password')
s.post('https://account.guildwars2.com/login', data=login_data)
r = s.get('https://leaderboards.guildwars2.com/en/na/achievements/guild/Darkhaven%20Elite')
print r.content

If you look at the form it's expecting the variables "email" and "password". You have "username" and "password"

Anyway, HTH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!