I am trying to programmatically log into this site using the Python Requests library:
login_url='https://login.drexel.edu/cas/login?service=https://one.drexel.edu/c/portal/login'
login_payload = {
'username':'lk12',
'password':'1q2w3e4r5t6y'
}
s = requests.post(login_url, data=login_payload)
print s.text
Note, the username
and password
key was retrieved from the page source's username and password id
field.
Upon running the script and looking at the output of s.text
, it appears I was never logged in despite my login credentials being valid. The output of s.text
is simply the login page.
Using Firefox, I checked what the cURL request looks like:
curl 'https://login.drexel.edu/cas/login?service=https%3A%2F%2Fone.drexel.edu%2Fc%2Fportal%2Flogin' -H 'Host: login.drexel.edu' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://login.drexel.edu/cas/login?service=https%3A%2F%2Fone.drexel.edu%2Fc%2Fportal%2Flogin' -H 'Cookie: JSESSIONID=B3DD2F8E144D98090AC63B995D9030AB; IDMSESSID=lk12' -H 'Connection: keep-alive' --data 'username=lk12&password=1q2w3e4r5t6y<=LT-745860-yMF7kyKD3SSVfeUmXPiDLWQobbczCq&execution=e2s1&_eventId=submit&submit=Connect'
That request looks exactly like my Python request. Not quite sure what I am doing wrong