rdegges/django-twilio

'Client' object has no attribute 'phone_numbers'

Closed this issue · 4 comments

Hey,

I'm using Twilio in my Django project:

django-twilio                    0.10.0   
twilio                           6.29.4   

However when I try accessing Twilio resources using the example in your documentation

I get an error:

'Client' object has no attribute 'phone_numbers'

Here is my code:

from django_twilio.client import twilio_client

for number in twilio_client.phone_numbers.iter():
    print(number.friendly_name)

which is breaking when i call phone_numbers on the client.

Please advise thanks!

jheld commented

Can you show us the dir(twilio_client)?

I haven't used that part of the code before (I have instantiated in other ways).

I don't think I have tested that high of a twilio lib version, either. Would be great to have testing around it.
It's also possible that the docs are simply behind (which would be unfortunate!).

Yeah I think they are behind... How would I use the Twilio resources then?

Here's the output of dir(twilio_client):

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_accounts', '_api', '_authy', '_autopilot', '_chat', '_conversations', '_fax', '_flex_api', '_insights', '_ip_messaging', '_lookups', '_messaging', '_monitor', '_notify', '_preview', '_pricing', '_proxy', '_serverless', '_studio', '_sync', '_taskrouter', '_trunking', '_verify', '_video', '_voice', '_wireless', 'account_sid', 'accounts', 'addresses', 'api', 'applications', 'auth', 'authorized_connect_apps', 'authy', 'autopilot', 'available_phone_numbers', 'balance', 'calls', 'chat', 'conferences', 'connect_apps', 'conversations', 'fax', 'flex_api', 'http_client', 'incoming_phone_numbers', 'insights', 'ip_messaging', 'keys', 'lookups', 'messages', 'messaging', 'monitor', 'new_keys', 'new_signing_keys', 'notifications', 'notify', 'outgoing_caller_ids', 'password', 'preview', 'pricing', 'proxy', 'queues', 'recordings', 'region', 'request', 'serverless', 'short_codes', 'signing_keys', 'sip', 'studio', 'sync', 'taskrouter', 'tokens', 'transcriptions', 'trunking', 'usage', 'username', 'validation_requests', 'verify', 'video', 'voice', 'wireless']

jheld commented

Ah ok. I think you want incoming_phone_numbers, the ones you bought (I think). As opposed to available_phone_numbers. Please check the docs on those if you can. Twilio docs. We'll update ours accordingly.

jheld commented

I have changed the docs! merged into master and should be building the version shortly.