Example #1
0
 def __init__(self, id="", dictionary=dict()):
     '''
      Reference: https://developers.facebook.com/docs/graph-api/reference/v2.8/album/
      '''
     self.id = ""
     self.can_upload = ""
     self.count = ""
     self.cover_photo = ""
     self.created_time = ""
     self.description = ""
     self.event = ""
     self.from_ = ""
     self.link = ""
     self.location = ""
     self.name = ""
     self.place = ""
     self.privacy = ""
     self.type = ""
     self.updated_time = ""
     if ("id" in dictionary):
         self.id = dictionary["id"]
     if ("can_upload" in dictionary):
         self.can_upload = dictionary["can_upload"]
     if ("count" in dictionary):
         self.count = dictionary["count"]
     if ("cover_photo" in dictionary):
         self.cover_photo = _Photo.Photo(
             dictionary=dictionary["cover_photo"])
     if ("created_time" in dictionary):
         self.created_time = dictionary["created_time"]
     if ("description" in dictionary):
         self.description = dictionary["description"]
     if ("event" in dictionary):
         self.event = _Events.Events(dictionary=dictionary["event"])
     if ("from" in dictionary):
         self.from_ = _User.FacebookUser(dictionary=dictionary["from"])
     if ("link" in dictionary):
         self.link = dictionary["link"]
     if ("location" in dictionary):
         self.location = dictionary["location"]
     if ("name" in dictionary):
         self.name = dictionary["name"]
     if ("place" in dictionary):
         self.place = dictionary["place"]
     if ("privacy" in dictionary):
         self.privacy = dictionary["privacy"]
     if ("type" in dictionary):
         self.type = dictionary["type"]
     if ("updated_time" in dictionary):
         self.updated_time = dictionary["updated_time"]
Example #2
0
 def getPhotos(self, token=None, timeout=(5,5), maxRetries=50):
     '''
     Reference: https://developers.facebook.com/docs/graph-api/reference/event/photos/
     '''
     import SolFB._Photo as _Photo
     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
Example #3
0
 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