Exemplo n.º 1
0
	def handle(self):
		subscription = self.lookup_subscription()
		if subscription is None:
			return render_template('unknown_number.twiml')

		friends = Friend.find_friends(subscription.number)
		listeners = 0
		for target in friends:
			try:
				client = get_twilio_instance()
				client.sms.messages.create(to=target.friendnum, from_='+12158393132', body="%s: %s" % (self.number, self.body))
				listeners += 1
			except Exception, e:
				pass
Exemplo n.º 2
0
	def handle(self):
		subscription = self.lookup_subscription()
		if subscription is None:
			return render_template('unknown_number.twiml')

		coords = geo.boundingBox(subscription.latitude, subscription.longitude, 10)
		subscribers = Subscription.find_in_area(subscription.number, coords[0], coords[1], coords[2], coords[3])

		listeners = 0
		for target in subscribers:
			try:
				client = get_twilio_instance()
				client.sms.messages.create(to=target.number, from_='+12158393132', body="Alert: %s" % (self.body))
				listeners += 1
			except Exception, e:
				pass