使用 Pycurl 向 FB 发送参数 api

Sending parameters with Pycurl to FB api

我正在尝试使用 documentation

中的 PyCurl 执行此 curl 请求
curl -G \
-d "date_preset=last_7_days" \
-d "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_CAMPAIGN_ID>/insights"

使用以下代码:

import pycurl
campaign_id = 'xxxxxx'
c = pycurl.Curl()
c.setopt(c.URL, "https://graph.facebook.com/2.4/campaign_id/insights?access_token=access_token")
c.perform()

但是我收到这个错误:

{"error":{"message":"Unknown path components: \/6012304320061\/insights","type":"OAuthException","code":2500}}

您缺少版本号前的版本字母:

"https://graph.facebook.com/v2.4/campaign_id/insights?access_token=access_token"