コード例 #1
0
 def run(self):
     """
     Count shares for all content items.
     """
     for content_item in self.api.orgs.simple_content():
         created = dates.parse_iso(content_item['created'])
         if created < self.max_age:
             continue
         url = content_item.get('url')
         if url:
             data = shares.count(url)
             data.pop('url', None)
             data['content_item_id'] = content_item.get('id')
             yield data
コード例 #2
0
 def test_facebook(self):
     counts = shares.count(url, sources='facebook')
     self.assertIn('facebook_shares', counts)
コード例 #3
0
 def test_all(self):
     counts = shares.count(url, sources='all')
     self.assertTrue(len(counts.keys()))
コード例 #4
0
 def test_twitter(self):
     counts = shares.count(url, sources='twitter')
     self.assertIn('twitter_shares', counts)
コード例 #5
0
 def test_reddit(self):
     counts = shares.count(url, sources='reddit')
     self.assertIn('reddit_upvotes', counts)
     self.assertIn('reddit_downvotes', counts)
コード例 #6
0
 def test_pinterest(self):
     counts = shares.count(url, sources='pinterest')
     self.assertIn('pinterest_shares', counts)
コード例 #7
0
 def test_linkedin(self):
     counts = shares.count(url, sources='linkedin')
     self.assertIn('linkedin_shares', counts)
コード例 #8
0
 def test_googleplus(self):
     counts = shares.count(url, sources='googleplus')
     self.assertIn('googleplus_shares', counts)
コード例 #9
0
 def test_facebookfql(self):
     counts = shares.count(url, sources='facebookfql')
     self.assertIn('facebook_shares', counts)
     self.assertIn('facebook_comments', counts)
     self.assertIn('facebook_likes', counts)