本文整理汇总了Python中SolFB._Utility.Utility类的典型用法代码示例。如果您正苦于以下问题:Python Utility类的具体用法?Python Utility怎么用?Python Utility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPosts
def getPosts(self, token=None, dateMin="", dateMax="", limit=100, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/v2.8/page/feed
'''
if (token==None):
token=_Actions.Actions.token
params={}
if (token == None):
token = _Actions.Actions.token
if (dateMin!="" and dateMax!="" and dateMin > dateMax):
raise Exception("Cannot use dateMin > dateMax")
if (dateMax != ""):
params["until"]=dateMax
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.5/"+self.id+"/feed?fields=id,caption,created_time,description,feed_targeting,from,icon,is_hidden,is_published,link,message,message_tags,name,object_id,parent_id,picture,place,privacy,properties,shares,source,status_type,story,targeting,to,type,updated_time,with_tags&limit=100&access_token="+token, timeout=timeout).json()
# print(r)
lista = list()
while ("data" in r and len(r["data"]) > 0):
for a in r["data"]:
post=_Post_Facebook.Post_Facebook(dictionary=a)
if ((len(lista)==limit) or (dateMin!="" and parse(post.created_time).replace(tzinfo=None)<dateMin)):
return lista
lista.append(post)
if ("next" in r["paging"]):
r = _Utility.prepareRequest(maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例2: getComments
def getComments(self,token=None, timeout=(5,5), maxRetries=50):
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/Comments?fields=id,attachment,can_comment,can_remove,can_like,comment_count,created_time,from,like_count,message,message_tags,object,parent,user_likes,is_hidden&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Comment.Comment(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例3: getLikes
def getLikes(self,token=None, timeout=(5,5), maxRetries=50):
if (token==None):
token=_Actions.Actions.token
#print("token="+str(token))
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/likes?&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_User.FacebookUser(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例4: getPhotos
def getPhotos(self, token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/album/photos
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/Photos?fields=id,album,backdated_time,backdated_time_granularity,can_delete,can_tag,created_time,from,height,icon,images,link,name,name_tags,page_story_id,picture,place,updated_time,width&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Photo.Photo(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例5: getAlbums
def getAlbums(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/page/albums/
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/albums?fields=id,can_upload,count,cover_photo,created_time,description,event,from,link,location,name,place,privacy,type,updated_time&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Albums.Albums(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例6: getVideos
def getVideos(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/page/videos/
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/videos?fields=backdated_time,backdated_time_granularity,id,created_time,description,embed_html,format,from,icon,is_instagram_eligible,length,permalink_url,picture,place,privacy,source,status,updated_time&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Video.Video(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例7: getEvents
def getEvents(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/page/events/
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/events?fields=id,can_guests_invite,cover,description,end_time,guest_list_enabled,is_page_owned,is_viewer_admin,name,owner,parent_group,start_time,ticket_uri,timezone,updated_time&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Events.Events(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例8: getPhotos
def getPhotos(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/page/photos/
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/photos?access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Photo.Photo(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例9: postLike
def postLike(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/object/likes
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).post("https://graph.facebook.com/v2.6/"+self.id+"/likes?&access_token="+token, timeout=timeout).json()
return str(r)
示例10: getFiles
def getFiles(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/group/files
'''
if (token==None):
token=_Actions.Actions.token
#print("token="+str(token))
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/files?fields=id,from,group,download_link,updated_time&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(a)
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例11: getAttending
def getAttending(self,token=None, timeout=(5,5), maxRetries=50):
'''
User: https://developers.facebook.com/docs/graph-api/reference/event/attending/
'''
if (token==None):
token=_Actions.Actions.token
#print("token="+str(token))
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/Attending?&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_User.FacebookUser(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例12: getLive_Videos
def getLive_Videos(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/event/live_videos/
'''
if (token==None):
token=_Actions.Actions.token
#print("token="+str(token))
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/live_videos?fields=id,broadcast_start_time,creation_time,description,from,is_reference_only,live_views,permalink_url,seconds_left,status,title,total_views,video&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Live_Videos.Live_Videos(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例13: getDocs
def getDocs(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/group/docs
'''
if (token==None):
token=_Actions.Actions.token
#print("token="+str(token))
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"/docs?fields=id,from,subject,message,icon,created_time,updated_time,revision,can_edit,can_delete&access_token="+token, timeout=timeout).json()
lista=list()
while ("data" in r and len(r["data"])>0):
for a in r["data"]:
lista.append(_Group_Doc.Group_Doc(dictionary=a))
if ("next" in r["paging"]):
r=_Utility.prepareRequest(maxRetries=maxRetries).get(r["paging"]["next"], timeout=timeout).json()
else:
break
return lista
示例14: delete
def delete(self,token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/photo
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).post("https://graph.facebook.com/v2.6/"+self.id+"?&access_token="+token+"&method=delete", timeout=timeout).json()
return str(r)
示例15: getInfo
def getInfo(self, token=None, timeout=(5,5), maxRetries=50):
'''
Reference: https://developers.facebook.com/docs/graph-api/reference/photo
'''
if (token==None):
token=_Actions.Actions.token
r=_Utility.prepareRequest(maxRetries=maxRetries).get("https://graph.facebook.com/v2.6/"+self.id+"?fields=id,album,backdated_time,backdated_time_granularity,can_delete,can_tag,created_time,from,height,icon,images,link,name,name_tags,page_story_id,picture,place,updated_time,width&access_token="+token, timeout=timeout).json()
c=Photo(dictionary=r)
return c;