@@ -0,0 +1,2121 @@
+from __future__ import print_function%0Aimport subprocess%0A%0Acredentials = %5B%5D%0Awith open('stolaf-base/whentowork.credentials', 'r') as when_to_work_credentials:%0A%09credentials = when_to_work_credentials.read().split('%5Cn')%0A%0Adef get_link_from_wtw_redirect_page(page_content):%0A%09link_start_pattern = '%3Ca HREF=%22'%0A%09link_start_index = page_content.find(link_start_pattern) + len(link_start_pattern)%0A%09link_end_index = page_content.find('%22%3E', link_start_index)%0A%09return page_content%5Blink_start_index:link_end_index%5D.replace('&amp;', '&')%0A%0Adef get_sid_from_homepage_link(homepage_link):%0A%09pattern = '/home?SID='%0A%09sid_start_index = homepage_link.find(pattern) + len(pattern)%0A%09return homepage_link%5Bsid_start_index:%5D%0A%0Abase_headers_list = %5B%0A%09%22-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0'%22,%0A%09%22-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'%22,%0A%09%22-H 'Accept-Language: en-US,en;q=0.5'%22,%0A%09%22-H 'Accept-Encoding: gzip, deflate'%22,%0A%09%22-H 'Referer: https://whentowork.com/logins.htm'%22,%0A%09%22-H 'Connection: keep-alive'%22,%0A%5D%0Abase_headers = ' '.join(base_headers_list)%0A%0Alogin_curl_bits = %5B%0A%09%22curl --silent 'https://whentowork.com/cgi-bin/w2w.dll/login'%22,%0A%09%22-H 'Host: whentowork.com'%22, base_headers,%0A%09%22--data 'NAS_id=76003&name=signin&UserId1=%22+credentials%5B0%5D+%22&Password1=%22+credentials%5B1%5D+%22&Submit1=Sign-In+Now'%22%0A%5D%0Alogin_curl = ' '.join(login_curl_bits)%0Alogin_redirect = subprocess.check_output(login_curl, shell=True)%0A%0Aredirect_link = get_link_from_wtw_redirect_page(login_redirect)%0A%0Awhos_up_next_curl_bits = %5B%0A%09%22curl --silent '%22 + redirect_link + %22'%22,%0A%09%22-H 'Host: www3.whentowork.com'%22, base_headers%0A%5D%0Awhos_up_next_curl = ' '.join(whos_up_next_curl_bits)%0Awhos_up_next_redirect = subprocess.check_output(whos_up_next_curl, shell=True)%0A%0Ahomepage_link = get_link_from_wtw_redirect_page(whos_up_next_redirect)%0ASID = get_sid_from_homepage_link(homepage_link)%0A%0Awhos_on_later_curl = %22curl --silent 'https://www3.whentowork.com/cgi-bin/w2wC.dll/empwhosonlater.htm?SID=%22 + SID + %22'%22%0Awhos_on_later_page = subprocess.check_output(whos_on_later_curl, shell=True)%0Aprint(whos_on_later_page)%0A

Add in the WhenToWork website scraper script