예제 #1
0
 def get_page_impressions_by_city(self, project, date_start, date_end, period='days_28'):
     url = '{}{}/{}/insights/page_impressions_by_city_unique?period={}&limit=1'.format(
             self.GRAPH_URL, self.GRAPH_VERSION, project.fanpage_id, period)
     json = requests.get(url,params={'access_token':project.fanpage_token}).json()
     data = json.get('data').pop().get('values')
     result = []
     for item in data:
         ms = util.iso_string_to_milliseconds(item.get('end_time'))
         result.append([ms, item.get('value')])        
     return result       
예제 #2
0
 def get_page_fans(self, project, date_start, date_end):
     """
     The number of likes of the fanpage
     """
     url = '{}{}/{}/insights/page_fans?period=lifetime&since={}&limit=100'.format(
             self.GRAPH_URL, self.GRAPH_VERSION, project.fanpage_id, date_start)
     json = requests.get(url,params={'access_token':project.fanpage_token}).json()
     data = json.get('data').pop().get('values')
     result = []
     for item in data:
         ms = util.iso_string_to_milliseconds(item.get('end_time'))            
         result.append([ms, item.get('value')])
     return result
예제 #3
0
 def get_page_engaged(self, project, date_start, date_end):
     """
     The number of people who engaged with your Page. 
     Engagement includes any click
     """
     url = '{}{}/{}/insights/page_engaged_users?period=day&since={}&limit=100'.format(
             self.GRAPH_URL, self.GRAPH_VERSION, project.fanpage_id, date_start)
     json = requests.get(url,params={'access_token':project.fanpage_token}).json()
     data = json.get('data').pop().get('values')
     result = []
     for item in data:
         ms = util.iso_string_to_milliseconds(item.get('end_time'))
         result.append([ms, item.get('value')])
     return result