I'm querying available phone numbers like so:
from twilio.rest import Client
client = Client(settings.TWILIO_ACCOUNT_SID, settings.TWILIO_AUTH_TOKEN)
available = client.available_phone_numbers("US").local.list()
I would like to loop through all of the available phone numbers as dictionary objects but as far as I can tell Twilio's Python SDK doesn't have anything like that.
I would have to do the following:
results = [{
"address_requirements": phone.address_requirements,
"beta": phone.beta,
"capabilities": phone.capabilities,
"MMS": phone.MMS,
"SMS": phone.SMS,
"fax": phone.fax,
"voice": phone.voice,
"friendly_name": phone.friendly_name,
"iso_country": phone.iso_country,
"lata": phone.lata,
"locality": phone.locality,
"longitude": phone.longitude,
"phone_number": phone.phone_number,
"postal_code": phone.postal_code,
"rate_center": phone.rate_center,
"region": phone.region
} for phone in available]
This seems silly to have to do since the API returns the exact format I want. I'm tempted to ditch the SDK and make the calls directly.