有测试号码,您可以使用我的考试证书向其发送短消息。他们假装发得很漂亮。但是,尝试使用Twilio提供的查找API,即使目的是检索有关试验编号的信息,也将失败:
>>> from django.conf import settings
>>> from twilio.rest.lookups import TwilioLookupsClient
>>> account_sid = settings.TWILIO_ACCOUNT_SID
>>> auth_token = settings.TWILIO_AUTH_TOKEN
>>> client = TwilioLookupsClient(account_sid, auth_token)
>>> lookup_client.phone_numbers.get('+15005555009', include_carrier_info=True)
---------------------------------------------------------------------------
TwilioRestException Traceback (most recent call last)
<ipython-input-9-03718f1c0615> in <module>()
----> 1 client.phone_numbers.get('+15005555009', include_carrier_info=True)
...
TwilioRestException:
HTTP Error Your request was:
GET https://lookups.twilio.com/v1/PhoneNumbers/+15005555009?Type=carrier
Twilio returned the following information:
Resource not accessible with Test Account Credentials
More information may be available here:
https://www.twilio.com/docs/errors/20008+15005555009是唯一一个模拟固定电话的电话号码,它不能返回短信。我期望API返回这样一个数字的载波类型的‘固定电话’。错误消息中的链接带我访问了一个没有工作测试凭据的页面。
如何使用给定的测试凭据测试查找API?
发布于 2016-07-06 23:26:44
我认为您不能使用带有测试凭据的查找API。
从https://www.twilio.com/docs/api/rest/test-credentials ..。
“支助资源
您的测试凭据目前可用于与以下三种资源进行交互:
POST /2010-04-01/Accounts/{TestAccountSid}/IncomingPhoneNumbersPOST /2010-04-01/Accounts/{TestAccountSid}/SMS/MessagesPOST /2010-04-01/Accounts/{TestAccountSid}/Calls对具有测试凭据的任何其他资源的请求将收到一个403禁止的响应。将来,我们也可以利用这些资源进行测试。“
https://stackoverflow.com/questions/38233428
复制相似问题