Пример #1
0
def send_test_sms(recepient=None):
	details = sms_model.get()
	client = TwilioRestClient(details['account'], details['token'])

	t = threading.Thread(target=_send_sms_in_thread, 
				kwargs={"client": client,
					"from_": details['from_'],
					"to": recepient,
					"body": "Amon alert!"
				})
	t.start()
Пример #2
0
	def get(self, param=None):
		errors =  self.session.get('errors',None)
		form_data =  self.session.get('form_data',None)
		details = sms_model.get()

		self.delete_session_key('errors')
		self.delete_session_key('form_data')

		self.render('settings/sms/update_sms_details.html',
					details=details,
					errors=errors,
					form_data=form_data)
Пример #3
0
def send_sms(alert=None, recepients=None, template=None):
	details = sms_model.get()
	
	try:
		client = TwilioRestClient(details['account'], details['token'])
	except:
		client = None
	
	
	if client != None:
		body = render_template(alert=alert, template=template)

		for recepient in recepients:
			t = threading.Thread(target=_send_sms_in_thread, 
				kwargs={"client": client,
					"from_": details['from_'],
					"to": recepient['phone'],
					"body": body
				}
			)
			t.start()
Пример #4
0
	def get(self, param=None):
		details = sms_model.get()
		recepients = sms_recepient_model.get_all()
		self.render('settings/sms/sms.html', details=details,
			recepients=recepients)