Twilio查找测试编号

Twilio查找测试编号,twilio,twilio-api,Twilio,Twilio Api,您可以使用向其发送短信。他们假装送得很漂亮。但是,尝试使用也由Twilio提供的,即使目的是检索有关的信息,也将失败: >>> from django.conf import settings >>> from twilio.rest.lookups import TwilioLookupsClient >>> account_sid = settings.TWILIO_ACCOUNT_SID >>> auth_token

您可以使用向其发送短信。他们假装送得很漂亮。但是,尝试使用也由Twilio提供的,即使目的是检索有关的信息,也将失败:

>>> 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
来自django.conf导入设置的
>
>>>从twilio.rest.lookups导入TwilioLookupsClient
>>>帐户\u sid=settings.TWILIO\u帐户\u sid
>>>身份验证令牌=settings.TWILIO\u身份验证令牌
>>>client=twiliookupsclient(帐户sid、身份验证令牌)
>>>查找客户.电话号码.获取('+15005555009',包括运营商信息=True)
---------------------------------------------------------------------------
TwilioRestException回溯(最近一次调用)
在()
---->1客户。电话号码。获取(“+15005555009”,包含运营商信息=True)
...
例外情况:
HTTP错误您的请求是:
得到https://lookups.twilio.com/v1/PhoneNumbers/+15005555009?类型=载体
Twilio返回了以下信息:
无法使用测试帐户凭据访问资源
有关更多信息,请访问:
https://www.twilio.com/docs/errors/20008
+15005555009是列出的唯一一个模拟固定电话的电话号码,无法返回短信。我希望API会为这样一个号码的载波类型返回“固定线路”。将我带到没有工作测试凭据的页面


如何使用给定的测试凭据测试查找API?

我认为您不能使用带有测试凭据的查找API

“支持的资源

您的测试凭据当前可用于与以下三种资源交互:

  • 购买电话号码:
    POST
    /2010-04-01/Accounts/{TestAccountSid}/IncomingPhoneNumber

  • 发送短信:
    POST
    /2010-04-01/Accounts/{TestAccountSid}/SMS/Messages

  • 打电话:
    POST/2010-04-01/Accounts/{TestAccountSid}/calls


对具有测试凭据的任何其他资源的请求将收到403禁止响应。将来,我们可能还会启用这些资源进行测试。“

Dang。无论如何谢谢你!