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"]
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
def getEvents(self, replyType=None, timeout=(5, 5), maxRetries=50): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/user/events/ ''' import SolFB._Events as _Events params = {} if (replyType != None): params = {"type": replyType} r = _Utility.prepareRequest(maxRetries=maxRetries).get( "https://graph.facebook.com/v2.6/me/Events?fields=rsvp_status,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=" + self.token, timeout=timeout, params=params).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
def __init__(self, id="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/photo ''' import SolFB._Albums as _Albums self.id = id self.album = "" self.backdated_time = "" self.backdated_time_granularity = "" self.can_delete = "" self.can_tag = "" self.created_time = "" self.event = "" self.from_ = "" self.height = "" self.icon = "" self.images = "" self.link = "" self.name = "" self.name_tags = "" self.page_story_id = "" self.picture = "" self.place = "" self.updated_time = "" self.width = "" if ("id" in dictionary): self.id = dictionary["id"] if ("album" in dictionary): self.album = _Albums.Albums(dictionary=dictionary["album"]) if ("backdated_time" in dictionary): self.backdated_time = dictionary["backdated_time"] if ("backdated_time_granularity" in dictionary): self.backdated_time_granularity = dictionary[ "backdated_time_granularity"] if ("can_delete" in dictionary): self.can_delete = dictionary["can_delete"] if ("can_tag" in dictionary): self.can_tag = dictionary["can_tag"] if ("created_time" in dictionary): self.created_time = dictionary["created_time"] if ("event" in dictionary): self.created_time = _Events.Events(dictionary=dictionary["event"]) if ("from" in dictionary): self.from_ = dictionary["from"] if ("height" in dictionary): self.height = dictionary["height"] if ("icon" in dictionary): self.icon = dictionary["icon"] if ("images" in dictionary): self.images = dictionary["images"] if ("link" in dictionary): self.link = dictionary["link"] if ("name" in dictionary): self.name = dictionary["name"] if ("name_tags" in dictionary): self.name_tags = dictionary["name_tags"] if ("page_story_id" in dictionary): self.page_story_id = dictionary["page_story_id"] if ("picture" in dictionary): self.picture = dictionary["picture"] if ("place" in dictionary): self.place = dictionary["place"] if ("updated_time" in dictionary): self.updated_time = dictionary["updated_time"] if ("width" in dictionary): self.width = dictionary["width"]