RJ Cole
RJ Cole

Reputation: 31

How to log in to Microsoft Live through Python

I'm not entirely new to Python, but I'm looking for a way to log in to Windows Live through Python.

Now I know there are already posts on here about this, but I keep having troubles with it. The website is, http://login.live.com/, and I have found the name of the input forms, for the email it is "login" and for the password it is "passwd". But I don't get it. I used several scripts on here similar to what I'm trying to do and I tried to integrate it with this and it didn't work.

Here is part of my code

import requests
import sys

   EMAIL = 'replace with actual email'
   PASSWORD = 'replace with actual password'

   URL = 'https://login.live.com/'

   def main():
# Start a session so we can have persistant cookies
session = requests.session(config={'verbose': sys.stderr})

# This is the form data that the page sends when logging in
login_data = {
    'login': EMAIL,
    'passwd': PASSWORD,
    'submit': 'login',
}

And the problem with this is that I'm stuck and I don't know what to do now, I keep getting a verbose error on Python 2.7 (http://gyazo.com/a433611b70c4f6707987cdd9fc4e467e) that I can't fix, and I don't know how to verify all this and then have it reply if you logged in or if the passwords fake...

Upvotes: 3

Views: 4782

Answers (1)

Vikas
Vikas

Reputation: 8948

The error is exactly what the error message says. requests.session takes no arguments and you are passing an argument to it. Usage:

session = requests.Session()
login_data = {
    'login': EMAIL,
    'passwd': PASSWORD,
    'submit': 'login',
}

session.post( URL, data = login_data )

Upvotes: 4

Related Questions