1 Replies - 311 Views - Last Post: 25 March 2013 - 12:44 PM Rate Topic: -----

#1 techkid_15  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-March 13

Log into website using requests module- what html variables to use

Posted 25 March 2013 - 11:08 AM

I am playing in an intramural sports league at my college, and recently got screwed by the organizers because they changed the time of our game and didn't notify us. I am trying to write a script that will monitor this site: http://www.imleagues.com/Default.aspx to make sure it doesn't happen again. But first, I must log in here: https://www.imleagues.com/Login.aspx

I have no clue what to set my username, password, and submit to. As in the html variable used in imleagues code. I've done some html and php coding before, but theirs is a little over my head, and I'm lost.

When I run this code, it redirects the request for a page I need to be logged in for back to the login page (it prints the login page html). Any help would be appreciated. Thanks!

Code so far:

import requests
import sys
import json

EMAIL = '**********'
PASSWORD = '*************'

URL = 'https://www.imleagues.com/Login.aspx'


    # 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 = {
    'ctl00$ContentPlaceHolder1$inUserName': EMAIL,
    'ctl00$ContentPlaceHolder1$inPassword': PASSWORD,
    'submit': 'aspnetForm',
}
    # Authenticate
r = session.post(URL, data=login_data)

    # Try accessing a page that requires you to be logged in
r = session.get('http://www.imleagues.com/School/Portal.aspx?SchId=aa43322933e640ed9712425c53ede335&Id=1504596&Portal=Announcement')



Is This A Good Question/Topic? 0
  • +

Replies To: Log into website using requests module- what html variables to use

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10807
  • View blog
  • Posts: 40,286
  • Joined: 27-December 08

Re: Log into website using requests module- what html variables to use

Posted 25 March 2013 - 12:44 PM

This seems to violate the spirit of their TOS, so we can't help you with this. You can shoot me a PM with any questions. Topic closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1