def __init__(self, id="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/app-request/ ''' self.id = id self.action_type = "" self.application = "" self.created_time = "" self.data = "" self.from_ = "" self.message = "" self.object = "" self.to = "" if ("id" in dictionary): self.id = dictionary["id"] if ("action_type" in dictionary): self.action_type = dictionary["action_type"] if ("application" in dictionary): self.application = dictionary["application"] if ("created_time" in dictionary): self.created_time = dictionary["created_time"] if ("data" in dictionary): self.data = dictionary["data"] if ("from" in dictionary): self.from_ = _User.FacebookUser(dictionary=dictionary["from"]) if ("message" in dictionary): self.message = dictionary["message"] if ("object" in dictionary): self.object = dictionary["object"] if ("to" in dictionary): self.to = _User.FacebookUser(dictionary=dictionary["to"])
def __init__(self, id="",dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/v2.8/achievement ''' self.id=id self.application="" self.data="" self.end_time="" self.from_="" self.image="" self.is_explicitly_shared="" self.message="" self.message_tags="" self.no_feed_story="" self.photos="" self.place="" self.from_="" self.publish_time="" self.ref="" self.start_time="" self.tags="" self.type="" if ("id" in dictionary): self.id=dictionary["id"] if ("application" in dictionary): self.application=dictionary["application"] if ("data" in dictionary): self.data="data" if ("end_time" in dictionary): self.end_time=dictionary["end_time"] if ("from" in dictionary): self.from_=_User.FacebookUser(dictionary=dictionary["from"]) if ("image" in dictionary): self.image=dictionary["image"] if ("is_explicitly_shared" in dictionary): self.is_explicitly_shared=dictionary["is_explicitly_shared"] if ("message" in dictionary): self.message=dictionary["message"] if ("message_tags" in dictionary): self.message_tags=dictionary["message_tags"] if ("no_feed_story" in dictionary): self.no_feed_story=dictionary["no_feed_story"] if ("photos" in dictionary): self.photos=dictionary["photos"] if ("place" in dictionary): self.place=_Place.Place(dictionary=dictionary["place"]) if ("publish_time" in dictionary): self.publish_time=dictionary["publish_time"] if ("ref" in dictionary): self.ref=dictionary["ref"] if ("from" in dictionary): self.from_=_User.FacebookUser(dictionary=dictionary["from"]) if ("start_time" in dictionary): self.start_time=dictionary["start_time"] if ("tags" in dictionary): self.tags=dictionary["tags"] if ("type" in dictionary): self.type=dictionary["type"]
def __init__(self, id="", dictionary=dict()): self.id = id self.from_ = "" self.subject = "" self.message = "" self.icon = "" self.created_time = "" self.updated_time = "" self.revision = "" self.can_edit = "" self.can_delete = "" if ("id" in dictionary): self.id = dictionary["id"] if ("from" in dictionary): self.from_ = _User.FacebookUser(dictionary=dictionary["from"]) if ("subject" in dictionary): self.subject = dictionary["subject"] if ("message" in dictionary): self.message = dictionary["message"] if ("icon" in dictionary): self.icon = dictionary["icon"] if ("created_time" in dictionary): self.created_time = dictionary["created_time"] if ("updated_time" in dictionary): self.updated_time = dictionary["updated_time"] if ("revision" in dictionary): self.revision = dictionary["revision"] if ("can_edit" in dictionary): self.can_edit = dictionary["can_edit"] if ("can_delete" in dictionary): self.can_delete = dictionary["can_delete"]
def __init__(self,id="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/education-experience/ ''' self.id=id self.classes=list() self.concentration=list() self.degree="" self.school="" self.type="" self.with_=list() self.year="" if ("id" in dictionary): self.id=dictionary["id"] if ("classes" in dictionary): for experience in dictionary["classes"]: self.classes.append(_Experience.Experience(dictionary=dictionary["classes"])) if ("concentration" in dictionary): for page in dictionary["concentration"]: self.concentration.append(_Page.Page(dictionary=dictionary["concentration"])) if ("degree" in dictionary): self.degree=_Page.Page(dictionary=dictionary["degree"]) if ("school" in dictionary): self.school=_Page.Page(dictionary=dictionary["school"]) if ("type" in dictionary): self.type=dictionary["type"] if ("with" in dictionary): for user in dictionary["with"]: self.with_.append(_User.FacebookUser(dictionary=dictionary["with"])) if ("year" in dictionary): self.year=_Page.Page(dictionary=dictionary["year"])
def __init__(self, id="",dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/experience/ ''' self.id=id self.description="" self.from_="" self.name="" self.with_=list() if ("id" in dictionary): self.id=dictionary["id"] if ("description" in dictionary): self.description=dictionary["description"] if ("from" in dictionary): self.from_=_User.FacebookUser(dictionary= dictionary["from"]) if ("name" in dictionary): self.name=dictionary["name"] if ("with" in dictionary): for user in dictionary["with"]: self.with_.append(_User.FacebookUser(dictionary=dictionary["with"]))
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 __init__(self, id="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/page-admin-note/ ''' self.body = "" self.from_ = "" self.id = id self.user = "" if ("body" in dictionary): self.body = dictionary["body"] if ("from" in dictionary): self.from_ = _Page.Page(dictionary=dictionary["from"]) if ("id" in dictionary): self.id = dictionary["id"] if ("user" in dictionary): self.user = _User.FacebookUser(dictionary=dictionary["user"])
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
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
def getFamily(self, timeout=(5, 5), maxRetries=50): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/user/family ''' r = _Utility.prepareRequest(maxRetries=maxRetries).get( "https://graph.facebook.com/v2.6/me/Family?fields=id,name,relationship&access_token=" + self.token, timeout=timeout).json() lista = list() print(r) while ("data" in r and len(r["data"]) > 0): for a in r["data"]: lista.append(_FacebookUser.FacebookUser(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="", created_time="", message="", story="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/post ''' self.id = id self.admin_creator = list() self.created_time = created_time self.message = message self.story = story self.caption = "" self.description = "" self.feed_targeting = "" self.created_by = "" self.icon = "" self.is_hidden = "" self.is_published = "" self.link = "" self.from_ = "" self.message_tags = list() self.name = "" self.object_id = "" self.parent_id = "" self.picture = "" self.place = _Place.Place() self.privacy = _Privacy.Privacy() self.properties = list() self.shares = 0 self.source = "" self.status_type = "" #enum{mobile_status_update, created_note, added_photos, added_video, shared_story, created_group, created_event, wall_post, app_created_story, published_story, tagged_in_photo, approved_friend} self.targeting = _Targeting.Targeting() self.to = list() self.type = "" #enum{link, status, photo, video, offer} self.updated_time = "" self.with_tags = list() if ("id" in dictionary): self.id = dictionary["id"] if ("admin_creator" in dictionary): for i in dictionary["admin_creator"]: self.admin_creator.append( _FacebookUser.FacebookUser(dictionary=i)) if ("application" in dictionary): self.application = dictionary["application"] if ("call_to_action" in dictionary): self.call_to_action = dictionary["call_to_action"] if ("caption" in dictionary): self.caption = dictionary["caption"] if ("created_time" in dictionary): self.created_time = dictionary["created_time"] if ("description" in dictionary): self.description = dictionary["description"] if ("feed_targeting" in dictionary): self.feed_targeting = _Feed_Targeting.Feed_Targeting( dictionary=dictionary["feed_targeting"]) if ("from" in dictionary): self.from_ = _FacebookUser.FacebookUser( dictionary=dictionary["from"]) if ("icon" in dictionary): self.icon = dictionary["icon"] if ("is_hidden" in dictionary): self.is_hidden = dictionary["is_hidden"] if ("is_published" in dictionary): self.is_published = dictionary["is_published"] if ("link" in dictionary): self.link = dictionary["link"] if ("message" in dictionary): self.message = dictionary["message"] if ("message_tags" in dictionary): self.message_tags = dictionary["message_tags"] if ("name" in dictionary): self.name = dictionary["name"] if ("object_id" in dictionary): self.object_id = dictionary["object_id"] if ("parent_id" in dictionary): self.parent_id = dictionary["parent_id"] if ("picture" in dictionary): self.picture = dictionary["picture"] if ("place" in dictionary): self.place = dictionary["place"] if ("privacy" in dictionary): self.privacy = dictionary["privacy"] if ("properties" in dictionary): for i in dictionary["properties"]: self.properties.append(_Properties.Properties(dictionary=i)) if ("shares" in dictionary): self.shares = dictionary["shares"] if ("source" in dictionary): self.source = dictionary["source"] if ("status_type" in dictionary): self.status_type = dictionary["status_type"] if ("story" in dictionary): self.story = dictionary["story"] if ("story_tags" in dictionary): self.story_tags = dictionary["story_tags"] if ("targeting" in dictionary): self.targeting = dictionary["targeting"] if ("to" in dictionary): for i in dictionary["to"]: self.to.append(_FacebookUser.FacebookUser(dictionary=i)) if ("type" in dictionary): self.type = dictionary["type"] if ("updated_time" in dictionary): self.updated_time = dictionary["updated_time"] if ("with_tags" in dictionary): self.with_tags = dictionary["with_tags"]
def __init__(self,id="", dictionary=dict()): ''' Reference: https://developers.facebook.com/docs/graph-api/reference/v2.8/comment ''' import SolFB._FacebookUser as _User self.id=id self.attachment="" self.can_comment="" self.can_remove="" self.can_hide="" self.can_like="" self.can_reply_privately="" self.comment_count="" self.created_time="" self.from_="" self.like_count="" self.message="" self.message_tags="" self.object="" self.parent="" self.private_reply_conversation="" self.user_likes="" self.message="" self.is_hidden="" if ("id" in dictionary): self.id=dictionary["id"] if ("attachment" in dictionary): self.attachment=_Story_Attachment.Story_Attachment(dictionary["attachment"]) if ("can_comment" in dictionary): self.can_comment=dictionary["can_comment"] if ("can_remove" in dictionary): self.can_remove=dictionary["can_remove"] if ("can_hide" in dictionary): self.can_hide=dictionary["can_hide"] if ("can_like" in dictionary): self.can_like=dictionary["can_like"] if ("can_reply_privately" in dictionary): self.can_reply_privately=dictionary["can_reply_privately"] if ("comment_count" in dictionary): self.comment_count=dictionary["comment_count"] if ("created_time" in dictionary): self.created_time=dictionary["created_time"] if ("from" in dictionary): self.from_=_User.FacebookUser(dictionary=dictionary["from"]) if ("like_count" in dictionary): self.like_count=dictionary["like_count"] if ("message" in dictionary): self.message=dictionary["message"] if ("message_tags" in dictionary): self.message_tags=dictionary["message_tags"] if ("object" in dictionary): self.object=dictionary["object"] if ("parent" in dictionary): self.parent=dictionary["parent"] if ("private_reply_conversation" in dictionary): self.private_reply_conversation=dictionary["private_reply_conversation"] if ("user_likes" in dictionary): self.user_likes=dictionary["user_likes"] if ("message" in dictionary): self.message=dictionary["message"] if ("is_hidden" in dictionary): self.is_hidden=dictionary["is_hidden"]