-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
41 lines (32 loc) · 1.14 KB
/
Main.py
File metadata and controls
41 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
__author__ = 'Sebastian Fiorini'
from twilio.rest import TwilioRestClient
import twilio.twiml
from flask import Flask, request, redirect
direction = __import__ ("GoogleDirections")
# put your own credentials here
ACCOUNT_SID = "AC661f3b2e9a88f232a643df46196cfec1"
AUTH_TOKEN = "cce4162f1d6ddef1bb19762b26887666"
app = Flask(__name__)
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
def sendText(text):
#from_="+13658000276",
client.messages.create(
to="+19055509650",
from_="+14155992671",
body=text,
)
@app.route("/", methods=['GET', 'POST'])
def getText():
message = " "
#from_number = request.values.get('From', None)
begin, stop = direction.parseText('from:Sinclair Secondary School, Whitby, ON, Canada To:Crescent School, Toronto, ON, Canada')
dirs, dist = direction. getDirections(begin, stop)
resp = twilio.twiml.Response()
for i in range(0, len(dirs)):
message = str(int(i)+1) + ". " + dirs[i] + " (" + dist[i] + ")\n"
resp.message(message)
#resp = twilio.twiml.Response()
#resp.message(message)
return str(resp)
if __name__ == "__main__":
app.run(debug=True)