0
votes

[Summarize the problem]

I've followed a process of facebook marketing api docs, but I failed to connect facebook marketing api to my python program. Response Message is 'Call was not successful'

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

[Provide background and tell us what you've already tried]

Hi. I'm a data analyst of my company. I'm trying to connect facebook marketing api to my python program. Version of Python is 3.7

I want to load daily marketing campaign cost of my company from facebook-ads. I've succeeded to connect googleads api to my python program(called PDP), but I failed to connect facebook marketing api to PDP.

First, I've search and followed the process of facebook marketing api docs. -https://github.com/facebook/facebook-python-business-sdk?fbclid=IwAR26VDtM_hCRQqoZwrdlzy-nne8QZwN_j6oWxqDfxTtrUcELssFNTn_MRrM

-in this docs, 'Bootstrapping' part doesn't work.

-I think I put right app id, app secret, access_token.

-Please check below images and let me know If I something lost.

[code]

import sys

sys.path.append('/usr/local/lib/python3.7/site-packages')

sys.path.append('/usr/local/lib/python3.7/site-packages/facebook_business-3.0.0-py2.7.egg-info')

from facebook_business.api import FacebookAdsApi

from facebook_business.adobjects.adaccount import AdAccount

my_app_id = '*******'

my_app_secret = '*******'

my_access_token = '*******'

FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)

my_account = AdAccount('act_<*******>')

campaigns = my_account.get_campaigns()

print(campaigns)

[Describe expected and actual result]

I guess if the code works, It should be printed the list of campaigns.

1

1 Answers

0
votes

I found the way to solve problem.

[code]

my_account = AdAccount('act_<*******>')

---> my_account = AdAccount('act_*******')

'<>' must be removed.

Refer to above way if somebody have same problem like me.