示例#1
0
	def testSendEmail(self):
		"""
		Tests to see if we can send an email successfully
		"""
		#Todo: Read test information from file
		with open('../credentials.txt') as f:
			username, password = f.readline().rstrip('\n'), f.readline().rstrip('\n')
		messageClient = messageHandler(username, password)
		self.assertEquals(messageClient.sendEmailMessage('*****@*****.**', 'Test Email', 'Hello World!'), {})
示例#2
0
	def testSendEmail(self):
		"""
		Tests to see if we can send a text message successfully
		"""
		#Todo: Read test information from file
		with open('../credentials.txt') as f:
			username, password = f.readline().rstrip('\n'), f.readline().rstrip('\n')
		messageClient = messageHandler(username, password)
		self.assertEquals(messageClient.sendTextMessage('4087057358', 'AT&T', 'Hello World!'), {})
示例#3
0
def main():
	zipCode, receiveTexts, recipientEmail 	= promptUserForLocation()
	username, password 						= getUsernameAndPassword('credentials.txt')
	messageClient 							= messageHandler(username, password)
	todaysWeather 							= getWeather(zipCode)

	if receiveTexts:
		recipients = populateListOfRecipients('recipients.txt')

		for recipient in recipients:
			messageClient.sendTextMessage(recipient['number'], recipient['gateway'], todaysWeather)
	else:
		messageClient.sendEmailMessage(recipientEmail, todaysWeather)