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

Batch Execute Error #625

Open
jlpetracca opened this issue Jan 22, 2023 · 0 comments
Open

Batch Execute Error #625

jlpetracca opened this issue Jan 22, 2023 · 0 comments

Comments

@jlpetracca
Copy link

  • Lastest version

I am trying to read some Adcreative in a batch but i have this error

AttributeError: 'FacebookAdsApi' object has no attribute 'GRAPH'

this is the code

`from facebook_business import FacebookSession
from facebook_business import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.ad import Ad
from facebook_business.adobjects.adset import AdSet

session = FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token,api_version='v15.0')
api = FacebookAdsApi(session)

FacebookAdsApi.set_default_api(api)
my_api_batch = api.new_batch()

AdCreative('ADIDADIDADID').api_get(batch = my_api_batch , fields=[
AdCreative.Field.account_id,
])

AdCreative('ADIDADIDADID').api_get(batch = my_api_batch , fields=[
AdCreative.Field.account_id,
])
my_api_batch.execute()`

this is the error

`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [8], in
16 AdCreative('ADIDADIDADID').api_get(batch = my_api_batch , fields=[
17 AdCreative.Field.account_id,
18 AdCreative.Field.actor_id,
(...)
27
28 ])
30 AdCreative('ADIDADIDADID').api_get(batch = my_api_batch , fields=[
31 AdCreative.Field.account_id,
32 AdCreative.Field.actor_id,
(...)
41
42 ])
---> 45 my_api_batch.execute()

File /opt/homebrew/lib/python3.9/site-packages/facebook_business/api.py:510, in FacebookAdsApiBatch.execute(self)
507 if call_files:
508 files.update(call_files)
--> 510 fb_response = self._api.call(
511 method,
512 path,
513 params=params,
514 files=files,
515 )
517 responses = fb_response.json()
518 retry_indices = []

File /opt/homebrew/lib/python3.9/site-packages/facebook_business/api.py:301, in FacebookAdsApi.call(self, method, path, params, headers, files, url_override, api_version)
296 self._num_requests_attempted += 1
298 if not isinstance(path, six.string_types):
299 # Path is not a full path
300 path = "/".join((
--> 301 url_override or self._session.GRAPH,
302 api_version,
303 '/'.join(map(str, path)),
304 ))
306 # Include api headers in http request
307 headers = headers.copy()

AttributeError: 'FacebookAdsApi' object has no attribute 'GRAPH'`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant