# -*- 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

 

twilio打电话和发短信的更多相关文章

  1. 打电话、发短信、web以及发邮件

    #import "ViewController.h" #import <MessageUI/MessageUI.h> //导入信息UI库 @interface View ...

  2. IOS 开发,调用打电话,发短信,打开网址

    IOS 开发,调用打电话,发短信,打开网址   1.调用 自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString: ...

  3. Android实例-打电话、发短信和邮件,取得手机IMEI号(XE8+小米2)

    结果: 1.不提示发短信卡住,点击没有反映,我猜想,可能是因为我用的是小米手机吧. 2.接收短信报错,我猜想可能是我改了里面的方法吧(哪位大神了解,求指教). 3.project -->opti ...

  4. iOS学习笔记(十四)——打电话、发短信

    电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话 [[UIApplication sharedApplicatio ...

  5. 代码控制打电话、发短信、发邮件、打开手机app等操作

    很多时候我们需要利用我门自己的app进行一些打电话.发短信等的操作,那么如何利用代码实现呢,下面就介绍一些简单的方法来实现这些操作. 一.打电话: <1>最简单.最直接的方法----直接跳 ...

  6. iOS10打电话、发短信、发邮件等小功能

    注意:iOS10.0以后,使用openURL会有延迟,需要使用 openURL: options: completionHandler: 一.概要 本文中主要就是介绍在iOS中实现打电话.发短信.发邮 ...

  7. Android Tips: 打电话和发短信

    利用Android打电话非常简单,直接调用Android内在的电话功能就可以了. btnDail.setOnClickListener(new OnClickListener(){ @Override ...

  8. iOS 打电话、发短信、邮件、打开网址、调用应用等合集

    iOS中的很多功能都是非常简单的,几行代码就搞定了,比如打电话.打开网址.发邮件.发短信等,这里总结几个比较常用的: 1.打电话 方式一:最简单最直接的方式:直接跳到拨号界面 NSURL *url = ...

  9. iOS开发——UI进阶篇(七)程序启动原理、打电话、发短信

    一.Info.plist常见的设置 1.建立一个工程后,会在Supporting files文件夹下看到一个“工程名-Info.plist”的文件,该文件对工程做一些运行期的配置,非常重要,不能删除 ...

随机推荐

  1. 权值树状数组 HDU-2852 KiKi's K-Number

    引入 权值树状数组就是数组下标是数值的数组,数组存储下标对应的值有几个数 题目 HDU-2852 KiKi's K-Number 题意 几种操作,p=0代表push:将数值为a的数压入盒子 p=1代表 ...

  2. [POJ3585]Accumulation Degree

    题面 \(\text{Solution:}\) 有些题目不仅让我们做树型 \(\text{dp}\) ,而且还让我们换每个根分别做一次, 然后这样就愉快的 \(\text{TLE}\) 了,所以我们要 ...

  3. [译]在Python中如何使用额enumerate 和 zip 来迭代两个列表和它们的index?

    enumerate - 迭代一个列表的index和item <Python Cookbook>(Recipe 4.4)描述了如何使用enumerate迭代item和index. 例子如下: ...

  4. 【转】 cocos2dx 3.x C++搭建protobuf环境

    http://blog.csdn.net/ganpengjin1/article/details/50964961 Cocos2dx 里面在网络游戏通信这一块一般我们都会采用protobuf来进行通信 ...

  5. [GitHub] - Unity Timer

    https://github.com/akbiggs/UnityTimer#unity-timer Run actions after a delay in Unity3D. This library ...

  6. HDU B-Ignatius and the Princess IV

    http://acm.hdu.edu.cn/showproblem.php?pid=1029 Problem Description "OK, you are not too bad, em ...

  7. Dubbo 的 Helloworld

    前提条件 安装好了 ZooKeeper 作为注册中心 服务端 <?xml version="1.0" encoding="UTF-8"?> < ...

  8. Hibernate常用方法之_查询

    1.使用session的get方法 public User getUser(int id){ Session session = null; User user = null; try { sessi ...

  9. BZOJ4551 Tjoi2016&Heoi2016树(离线+并查集)

    似乎是弱化的qtree3.树剖什么的非常无脑.考虑离线.并查集维护每个点的最近打标记祖先,倒序处理,删除标记时将其与父亲合并即可. #include<iostream> #include& ...

  10. poj2814-拨钟问题-C语言-枚举算法

    #include <stdio.h> #include <stdlib.h> /* 首先,我们考虑用长度为9的数组表示表盘的状态以及调表的操作,终止的条件是表盘状态数组所有元素 ...