paskalnikita
paskalnikita

Reputation: 161

Facebook requires v3.0 API

Two days ago facebook asked me to use version of sdk 3.0. While running script I have this problem:

(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v3.0.

For connecting to the API I use:

config_filename = os.path.join(this_dir, 'jsons/config.json')
 config_file = open(config_filename)
 config = json.load(config_file)
 config_file.close()
 session = FacebookSession(
 config['access_token'],
 config['app_id'],
     config['app_secret'],
)
api = FacebookAdsApi(session)
FacebookAdsApi.set_default_api(api)
print(FacebookAdsApi.API_VERSION)

Rinning

pip install facebook-ads-api

Tells:

Requirement already satisfied: facebook-ads-api in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (0.3.0)

Looking at documentation right here: https://facebook-sdk.readthedocs.io/en/latest/changes.html Status for version 3.0 is unreleased

On my facebook account, I upgraded the app to v3.0(from adManager).

So, I can't understand what am I doing wrong.

Thank you!

Upvotes: 0

Views: 1557

Answers (1)

paskalnikita
paskalnikita

Reputation: 161

My solution:

config_file = open('jsons/config.json')
config = json.load(config_file)
config_file.close()

session = FacebookSession(
    config['app_id'],
    config['app_secret'],
    config['access_token'],
)
api = FacebookAdsApi(session)

FacebookAdsApi.init(session.app_id, session.app_secret, session.access_token, api_version='v3.0')

Olso on page click I updated verions of API for an app

Upvotes: 2

Related Questions