Skip to content

Instantly share code, notes, and snippets.

@sethwoodworth
Created January 27, 2011 07:35
Show Gist options
  • Save sethwoodworth/798201 to your computer and use it in GitHub Desktop.
Save sethwoodworth/798201 to your computer and use it in GitHub Desktop.
mymoop
import urllib2
SENDER = 'mrbunwah@gmail.com'
RECEVIERS = ['mrbunwah@gmail.com']
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