【问题标题】:Get a twilio phone number SID, at a later date, if you don't capture it when you purchase twilio number如果您在购买 twilio 号码时未捕获它,请稍后获取 twilio 电话号码 SID
【发布时间】:2019-06-05 05:00:20
【问题描述】:

如果您在购买 twilio 号码时没有捕获电话号码 SID,有什么简单的方法可以在以后获取它。

购买号码时很容易捕获电话号码sid,但我发现以后捕获它的解决方案似乎很复杂并且使用循环。

在购买号码时捕获电话号码 SID:

from twilio.rest import Client

account_sid = 'accountsid'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

# Purchase the phone number
number = client.incoming_phone_numbers \
               .create(phone_number=number)

print(number.sid)

【问题讨论】:

    标签: python twilio twilio-api


    【解决方案1】:

    您可以使用“完全匹配”进行过滤。

    例如,如果您的号码是+17775553333,请尝试使用此代码获取sid

    from twilio.rest import Client
    
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    client = Client(account_sid, auth_token)
    
    incoming_phone_numbers = client.incoming_phone_numbers.list(phone_number='+17775553333', limit=20)
    
    for record in incoming_phone_numbers:
        print(record.sid)
    
    

    【讨论】:

      猜你喜欢
      • 2017-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多