如何获得洞察力指标Facebook Graph API?

时间:2018-04-30 21:15:07

标签: python facebook-graph-api

我做如下

import urllib
import json
import facebook
import requests 
import pandas as pd

page_id = 'page_id'
access_token = 'EAACEdEose0cBAHD2v11LX0.......'
base = "https://graph.facebook.com/v2.12"
node = "/" + page_id
parameters = "/insights/?metric=page_consumptions&period=day&since=2018-03-30&until=2018-04-30&access_token=%s" 
url = base + node + parameters
metrics = requests.get(url).json()
metrics

我变空data

{'data': [],
 'paging': {'next': 'https://graph.facebook.com/v2.12/

或者我喜欢这个

base = "https://graph.facebook.com/v2.12"
node = "/" + page_id
parameters = "?fields=insights.metric(page_consumptions)&period=day&since=2018-03-30&until=2018-04-30&access_token=%s"

url = base + node + '/feed'+ parameters+'&limit=10'
metrics = requests.get(url).json()
metrics

我只是发布了帖子

{'data': [{'id': '651703178310339_1036305106516809'},
  {'id': '651703178310339_1036057803208206'},
  {'id': '651703178310339_1035981129882540'},
  {'id': '651703178310339_1034909163323070'},
  {'id': '651703178310339_1034810636666256'},
  {'id': '651703178310339_1034675570013096'},
  {'id': '651703178310339_1034390016708318'},
  {'id': '651703178310339_1034167626730557'},
  {'id': '651703178310339_1033286533485333'},
  {'id': '651703178310339_1032920266855293'}],
 'paging': {'cursors':

我做错了什么? 附: 我正确地得到了这样的另一个内容

base = "https://graph.facebook.com/v2.12"
node = "/" + page_id
parameters = "/?access_token=%s" % access_token

until = '&since=2016-01-30&until=2018-04-30'
url = base + node +'/feed'+  parameters+'&limit=100'
pages = requests.get(url).json()
pages

0 个答案:

没有答案