Get the list of Facebook page IDs an account has access to using Python Facebook Marketing SDK

281 Views Asked by At

What would the call be to do this in the Python SDK?

Example of what part of the code I need, but can't find (this is wrong):

response = AdAccount(id).get_list_of_pages(fields, params)
1

There are 1 best solutions below

1
On BEST ANSWER

Figured it out. business_number is Facebook business manager ID as an integer. ad_account is advertising account number with act_ prefixed to the number.

params = {'business': business_number}
users = AdAccount(ad_account).get_assigned_users(params=params)
pages = AdAccountUser(users[0]['id']).get_pages()