1from twilio.rest import TwilioRestClient
2
3
4# Twilio phone number goes here. Grab one at https://twilio.com/try-twilio
5# and use the E.164 format, for example: "+12025551234"
6TWILIO_PHONE_NUMBER = ""
7
8# list of one or more phone numbers to dial, in "+19732644210" format
9DIAL_NUMBERS = ["",]
10
11# URL location of TwiML instructions for how to handle the phone call
12TWIML_INSTRUCTIONS_URL = \
13 "http://static.fullstackpython.com/phone-calls-python.xml"
14
15# replace the placeholder values with your Account SID and Auth Token
16# found on the Twilio Console: https://www.twilio.com/console
17client = TwilioRestClient("ACxxxxxxxxxx", "yyyyyyyyyy")
18
19
20def dial_numbers(numbers_list):
21 """Dials one or more phone numbers from a Twilio phone number."""
22 for number in numbers_list:
23 print("Dialing " + number)
24 # set the method to "GET" from default POST because Amazon S3 only
25 # serves GET requests on files. Typically POST would be used for apps
26 client.calls.create(to=number, from_=TWILIO_PHONE_NUMBER,
27 url=TWIML_INSTRUCTIONS_URL, method="GET")
28
29
30if __name__ == "__main__":
31 dial_numbers(DIAL_NUMBERS)
32