1.11M Members

How do I do the IF script in Python? (Logging in through website)

 
0
 
import requests
import sys

EMAIL = 'YOUR EMAIL GOES HERE'
PASSWORD = 'YOUR PASSWORD GOES HERE'

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

def main():
    # Start a session so we can have persistant cookies
    session = requests.Session()

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

    session.post( URL, data = login_data )

Alright so I have created this script that logs in to Live, but I am confused on how to test it, I am trying to see if it actually logs in, but I have no where to go. I need an IF statement, but I am confused on how to make that with the script since it evolves checking if it's logged in or not, and I don't know if the script works or not.

You
Post:
Start New Discussion
Tags Related to this Article