facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.29k stars 636 forks source link

adaccountusermixin.get_ad_accounts has the deprecated endpoint name. #465

Closed rorynelsonscott closed 6 years ago

rorynelsonscott commented 6 years ago

The get_ad_accounts method for AdAccountUser has the wrong endpoint name and will fail.

See here: https://github.com/facebook/facebook-python-ads-sdk/blob/master/facebookads/adobjects/helpers/adaccountusermixin.py#L54

rorynelsonscott commented 6 years ago

If anyone stumbles onto this, if you were previously using a system user or "me" as an AdUser and then using the get_ad_accounts method on that object, you'll need to now use the Business object.

from facebookads.adobjects.business import Business

bm_id ='<YOUR_BUSINESS_MANAGER_ID>'
user = Business(fbid=f'{bm_id}')

accounts = user.get_<owned/pending/client>_ad_accounts()