1,105,585 Community Members

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

Member Avatar
GGreek
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article