y0y075
y0y075

Reputation: 1

Getting "TypeError: get() got an unexpected keyword argument 'fields" using the Facebook Marketing API

I literally copied this code from Facebook's documentation.

But I get this error:

TypeError: get() got an unexpected keyword argument 'fields

the code I copied:

facebook_business.adobjects.adcreative import AdCreative
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<AD_CREATIVE_ID>'
FacebookAdsApi.init(access_token=access_token)

fields = [
  'name',
  'object_story_id',
]
params = {
}
print AdCreative(id).get(
  fields=fields,
  params=params,
)

Upvotes: 0

Views: 921

Answers (1)

Gino
Gino

Reputation: 31

There's a mistake in Facebook's documentation. .get() does not exist. Use api_get() instead.

Upvotes: 3

Related Questions