Created
January 27, 2011 07:35
-
-
Save sethwoodworth/798201 to your computer and use it in GitHub Desktop.
mymoop
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 urllib2 | |
SENDER = '[email protected]' | |
RECEVIERS = ['[email protected]'] | |
def send_message(message) | |
try: | |
smtpObj = smtplib.SMTP('localhost') | |
smtpObj.sendmail(SENDER, RECEVIERS, message) | |
print "Successfully sent email" | |
except SMTPException: | |
print "Error: unable to send email" | |
def read(data): | |
if data.find('open'): | |
message = "School's open :-(" | |
elif data.find('close'): | |
message = "School's closed :-)" | |
elif data.find('delay'): | |
message = "School's delayed. see http://www.umass.edu/closing/ for deets." | |
else: | |
message = "IDK what is happening... see http://www.umass.edu/closing/ for deets." | |
return message | |
if __name__ == '__main__': | |
data = urllib2.urlopen('http://www.umass.edu/closing/').read() | |
message = read(data) | |
send_message(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment