twilio打电话和发短信
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 | # -*- coding: utf-8 -*- # @Time : 2018/03/09 14:53 # @Author : cxa # @File : call.py # @Software: PyCharm # Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token can be found at https://www.twilio.com/console account_sid = "mysid" auth_token = "token" client = Client(account_sid, auth_token) # # Start a msg # call = client.messages.create( # to="+mynumber", # from_="+18162811118", # body="短信内容" # ) # Start a phone call call = client.calls.create( to = "+mynumber" , from_ = "+18162811118" , url = "http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient" ) print (call.sid) |
重要的一步默认没有授权中国地区的需要开启授权,
Account not authorized to call . Perhaps you need to enable some international permissions: twilio.com/user/account/settings/international
打电话的时候会一直报错
twilio.base.exceptions.TwilioRestException: HTTP 400 error: Unable to create record: The number +mynumberis unverified. Trial accounts may only make calls to verified numbers.
最后的解决方案是
Verified Caller IDs:
https://www.twilio.com/user/account/phone-numbers/verified
本文作者:公众号python学习开发
本文链接:https://www.cnblogs.com/c-x-a/p/8535115.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
2017-03-09 DataTables 1.10.x与1.9.x参数名对照表