#首先在该网站注册一个帐号 :https://www.twilio.com/ ,如何申请手机号此处省略,可百度一下
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 文件名:twilio_phone.py
from twilio.rest import *
”’
#发短信
account = “AC7635b9970—————————” #帐号,token 可在注册帐号信息中查看
token = “b19c——————————–“
client = Client(account, token)
message = client.messages.create(to=”+8615900000000″, from_=”+17200000000″,
body=”Hello there!”)
”’
#打电话
def call_phone():
account = “AC7635b9970—————————“
token = “b19c——————————–“
client = Client(account, token)
call = client.calls.create(to=”+8615900000000″, # to 为电话接受方
from_=”+17200000000″, # from 为twilio申请的手机号
url=”http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient”)