예제 #1
0
def uw_netid_login(netid, password):
    login_params = wu.parse_hidden_params(wu.send_get_request(WEBLOGIN_URL))
    login_params['user'] = netid
    login_params['pass'] = password

    ''' 
    TODO: Handle a) The WEBLOGIN_URL not opening, b) The username/pass being wrong
    '''
    wu.send_post_request(WEBLOGIN_URL, login_params)
예제 #2
0
def get_schedule_page(sched_params):
    '''
    Logs in through the schedule page by sending a relay to the pub-cookie
    through the relay atop the page.
    '''
    html_str = wu.send_get_request(SCHEDULE_URL, sched_params).read()
    while True:
        params = wu.parse_hidden_params(html_str)
        redirect_link = wu.parse_redirect_action(html_str)
        if redirect_link is None:
            break
        '''
        Send a post request to the 'document.onload' function using a POST so we can
        get our session id and load the page properly.
        '''
        resp = wu.send_post_request(redirect_link, params)
        html_str = resp.read()
    return html_str