I'm trying to make a program that can get your info for the game Gears of War 4. I know how to parse webpages and such, but I've never taken the time to log into a site through python.
Now this poses a problem as I need to log in to my Microsoft Live profile to get my stats. I've tried what I thought would work, but hit a dead end every time.
This is what I have so far (that works)
import requests
import urllib2
username = 'USERNAME@hotmail.com'
password = 'PASSWORD'
payload = {'loginfmt': username,
'passwd': password}
url = 'https://gearsofwar.com/en-us/cards'
initial_data = urllib2.urlopen(url).read()
sign_in = initial_data.find('signInUrl":"')
sign_in = initial_data[sign_in:].split('"')[2]
print sign_in
sign_in is the URL of the page I need to sign in to.
All I need is for someone to show me how to pass my username and password to the login page and then load the page that it redirects to. Everytime I try, I get html data saying that Javascript is not enabled.
Surely there is an easy way to do this that I'm overlooking?