获取一个 twilio phone 号码 SID,如果您在购买 twilio 号码时没有捕获它,请稍后获取
Get a twilio phone number SID, at a later date, if you don't capture it when you purchase twilio number
如果您在购买 twilio 号码时没有捕获到 phone 号码 SID,是否有任何简单的方法可以在以后获取它。
购买号码时很容易捕获一个phone号码sid,但我发现以后捕获它的解决方案似乎很复杂并且使用循环。
买号时抓取Phone号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)
您可以使用 "exact match" 进行过滤。
例如,如果您的电话号码是 +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)
如果您在购买 twilio 号码时没有捕获到 phone 号码 SID,是否有任何简单的方法可以在以后获取它。
购买号码时很容易捕获一个phone号码sid,但我发现以后捕获它的解决方案似乎很复杂并且使用循环。
买号时抓取Phone号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)
您可以使用 "exact match" 进行过滤。
例如,如果您的电话号码是 +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)