Exemplo n.º 1
0
	def test_addition(self):
		lat = 39.959141
		lng = -75.1513957
		rad = geo.boundingBox(lat, lng, 10)
		self.assertTrue(rad[0] < lat)
		self.assertTrue(rad[1] < lng)
		self.assertTrue(rad[2] > lat)
		self.assertTrue(rad[3] > lng)
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