I'm trying to pull a list of all phone numbers used by my subaccounts but I'm only able to get it to pull one messaging service at a time.
Here is my code:
services = client.messaging.services.list(limit=2000)
messageid= []
for record in services:
messageid.append(record.sid)
ddphones = []
phones = client.messaging.services(record.sid).phone_numbers.list(limit=1000)
for record in phones:
ddphones.append(record.service_sid)
ddphones.append(record.phone_number)
df = pd.DataFrame(ddphones)
ddd = pd.DataFrame(df.values.reshape(-1, 2), columns = ['MID', 'Phone'])