Commit 39b9d7498cabf5391bb8271b61648c7479161ee5

Authored by Noah ago
1 parent 2f9e1282a3
Exists in master

타임.에러 잡는중

Showing 1 changed file with 12 additions and 9 deletions Side-by-side Diff

insight/postinsight.py View file @ 39b9d74
... ... @@ -23,15 +23,18 @@
23 23  
24 24 def setContentInsight(self,content_id):
25 25  
26   - url ='https://graph.facebook.com/v2.5/%s?fields=message,created_time,link,comments.limit(5),type,insights{values}'%content_id
27   - txt = requests.get(url + self.token).text
28   - #print url + self.token
29   - self.data = json.loads(txt)
30   - self.setContentType(self.data)
31   - self.setContentComment(self.data)
32   - self.setLinkUrl(self.data)
33   - self.setContentCreated_time(self.data)
34   - #print self.data
  26 + try:
  27 + url ='https://graph.facebook.com/v2.5/%s?fields=message,created_time,link,comments.limit(5),type,insights{values}'%content_id
  28 + txt = requests.get(url + self.token).text
  29 + #print url + self.token
  30 + self.data = json.loads(txt)
  31 + self.setContentType(self.data)
  32 + self.setContentComment(self.data)
  33 + self.setLinkUrl(self.data)
  34 + self.setContentCreated_time(self.data)
  35 + #print self.data
  36 + except:
  37 + return
35 38 try:
36 39 for i in self.data['insights']['data']:
37 40 name = i['id'].split("/")[2]