Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Facebook Marketing: find_account method does not work on privacy filtered accounts #11750

Closed
mdibaiee opened this issue Apr 6, 2022 · 0 comments · Fixed by #11751
Closed

Comments

@mdibaiee
Copy link
Contributor

mdibaiee commented Apr 6, 2022

Hello!

The current implementation of _find_account of facebook-marketing source fetches a list of adaccounts and iterates over them, trying to match the account ID:

def _find_account(account_id: str) -> AdAccount:
"""Actual implementation of find account"""
try:
accounts = fb_user.User(fbid="me").get_ad_accounts()
for account in accounts:
if account["account_id"] == account_id:
return account
except FacebookRequestError as exc:
raise FacebookAPIException(f"Error: {exc.api_error_code()}, {exc.api_error_message()}") from exc
raise FacebookAPIException("Couldn't find account with id {}".format(account_id))

However, in some cases the AdAccount is not "listable" due to privacy filters, but it can still be accessed directly using a request like this:

curl -i -X GET \
 "https://graph.facebook.com/act_<AD_ACCOUNT_ID>"

From Facebook SDK's documentation and code samples, I can see they initialise new AdAccounts this way:

my_account = AdAccount('act_<your-adaccount-id>')

Sources:

mdibaiee added a commit to mdibaiee/airbyte that referenced this issue Apr 6, 2022
@lazebnyi lazebnyi changed the title Facebook Marketing find_account method does not work on privacy filtered accounts Source Facebook Marketing: find_account method does not work on privacy filtered accounts Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants