Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

facebook - Python - You are calling a deprecated version of the Ads API

Seems this is a commun issue when using Facebook APIs. I am trying to use the ads API using Python. When I am testing it using the Graph API Explorer, I have the version 9.0 and I am not getting any errors. I am trying to implement the API call using Python but when I am specifiying the version 9.0, I am getting this error log:

facebook.GraphAPIError: Valid API versions are '2.8', '2.9', '2.10', '2.11', '2.12', '3.0', '3.1'

My code:

import facebook
token = "<token>"
graph = facebook.GraphAPI(access_token=token, version="9.0")
events = graph.request("?ids=<id>")
print(events)

But when I am using the version 3.1 or < than 3.1, I am getting another error:

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

How can I fix it?

question from:https://stackoverflow.com/questions/65847453/python-you-are-calling-a-deprecated-version-of-the-ads-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Seems related to an older SDK (see the code on github)

I suggest you to update to the official Facebook SDK for Python


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...