Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Auto login script for CMU blackboard
import requests
import re
# Initial request for blackboard
r = requests.get('')
# Authenticaton
payload = { 'j_username' : '<your username>', 'j_password' : '<your password>', 'j_continue' : '1', 'submit' : 'Login' }
r2 =, data=payload, cookies=r.cookies)
# Manually proceed with the form
url = ''
relayState = str('name="RelayState" value="(.*)"', r2.text).group(1)).replace('&#x3a;', ':')
samlResponse = str('name="SAMLResponse" value="(.*)"', r2.text).group(1))
r3 =, data={'RelayState': relayState, 'SAMLResponse': samlResponse}, cookies=r2.cookies)

This comment has been minimized.

Copy link
Owner Author

@grapeot grapeot commented Jul 31, 2012

Depends on requests,

pip install requests

before running.


This comment has been minimized.

Copy link

@whhsw whhsw commented Aug 1, 2012

r4 =, data={'action': 'refreshAjaxModule', 'modId': '_4_1','tabId':'_1_1','tab_tab_group_id':'_1_1','RelayState': relayState, 'SAMLResponse': samlResponse}, cookies=r3.cookies, verify=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment