您可以使用我的测试凭据向一些测试号码发送短信。他们假装发送精美。但是,尝试使用同样由 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?