我们正忙于将 Facebook 的营销 API 升级到业务 API(不是图形 API 也不是营销 API)。该文档指出,应该能够使用以下代码创建 test.py:import syssys.path.append('/opt/homebrew/lib/python2.7/site-packages') sys.path.append('/opt/homebrew/lib/python2.7/site-packages/facebook_business-3.0.0-py2.7.egg-info') from facebook_business.api import FacebookAdsApifrom facebook_business.adobjects.adaccount import AdAccountmy_app_id = 'your-app-id'my_app_secret = 'your-appsecret'my_access_token = 'your-access-token'FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)my_account = AdAccount('your-adaccount-id')campaigns = my_account.get_campaigns()print(campaigns)这需要我使用以下哈希获得的应用程序秘密证明:facebook_app_id = 'xxxxx'facebook_app_secret = 'xxxxx'facebook_app_token = 'xxxxx|xxxxx'.format(facebook_app_id,facebook_app_secret)import hmac,hashlibapp_secret_proof = hmac.new(facebook_app_secret.encode('utf-8'), msg=facebook_app_token.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()print(app_secret_proof)这是我得到的错误:Traceback (most recent call last):File "test.py", line 12, in <module>FacebookAdsApi.init(my_app_id,my_app_secret,my_access_token,my_appsecret_proof)File "/Users/facebook_business/api.py", line 202, in initcls.set_default_account_id(account_id)File "/Users/facebook_business/api.py", line 225, in set_default_account_id"Account ID provided in FacebookAdsApi.set_default_account_id " ValueError: Account ID provided in FacebookAdsApi.set_default_account_id expects a string that begins with 'act_'没有一个 ID 以 act_ 开头,我目前正在使用应用仪表板左上角的应用 ID,我应该使用哪个?
添加回答
举报
0/150
提交
取消