Last active
December 31, 2015 16:29
-
-
Save JDougherty/8014167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
from BeautifulSoup import BeautifulSoup | |
USERNAME = "foo@bar.com" | |
PASSWORD = "quxadux" | |
def main(): | |
browser = mechanize.Browser() | |
print "Opening login page..." | |
browser.open("https://www.applyweb.com/cgi-bin/ustat?gatechg") | |
browser.open("https://www.applyweb.com/shibboleth/gatekeeper?dest=https%3A%2F%2Fwww.applyweb.com%2Fcgi-bin%2Fustat%3Fgatechg") | |
browser.select_form(nr=0) | |
browser["j_username"] = USERNAME | |
browser["j_password"] = PASSWORD | |
print "Logging in..." | |
response = browser.submit() | |
browser.select_form(nr=0) | |
print "Redirecting..." | |
browser.submit() | |
response = browser.open("https://www.applyweb.com/cgi-bin/ustat?app_code=gatechg") | |
response = response.read() | |
soup = BeautifulSoup(response) | |
status = soup.findAll('span', attrs={"class":"ufe-ustat-checklist-label"}, text="Application Status")[0].parent.parent.findNextSibling().text | |
print "Application Status: %s" % status | |
for note in soup.findAll(text="Note from Graduate Admissions"): | |
print "Note from Graduate Admissions:\n%s" % note.parent.parent.findNextSibling().text | |
if __name__ == '__main__': | |
main() |
(That login redirect stuff was nonsense.)
Ha, tell me about it. It also wasn't made any easier by the fact that I had a typo in my username and could not figure out for quite some time why I couldn't get the login to work...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Haha, we totally should have touched base. Nice though! I like it a lot.