Compare commits

...

4 Commits

Author SHA1 Message Date
Mads Marquart
0d5e4f6d3f Version up thanks to @enwar3 2017-06-29 16:03:55 +02:00
Mads Marquart
92a5ffdef8 Merge pull request #170 from OMGWINNING/master
Add extensible_attachment field to Message for fb share objects
2017-06-29 16:02:27 +02:00
Joe Lau
b3359fccdb Add last_message_timestamp to Thread objects 2017-06-28 18:08:45 -07:00
Joe Lau
d8f7366d1f Add extensible_attachment field to Message for fb share objects 2017-06-28 13:19:17 -07:00
4 changed files with 14 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ from .client import *
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
__version__ = '1.0.9'
__version__ = '1.0.10'
__license__ = 'BSD'
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
__email__ = 'carpedm20@gmail.com'

View File

@@ -71,6 +71,9 @@ class Client(object):
# If session cookies aren't set, not properly loaded or gives us an invalid session, then do the login
if not session_cookies or not self.setSession(session_cookies) or not self.isLoggedIn():
self.login(email, password, max_tries)
else:
self.email = email
self.password = password
"""
INTERNAL REQUEST METHODS

View File

@@ -75,7 +75,8 @@ def graphql_to_message(message):
text=message.get('message').get('text'),
mentions=[Mention(m.get('entity', {}).get('id'), offset=m.get('offset'), length=m.get('length')) for m in message.get('message').get('ranges', [])],
sticker=message.get('sticker'),
attachments=message.get('blob_attachments')
attachments=message.get('blob_attachments'),
extensible_attachment=message.get('extensible_attachment')
)
def graphql_to_user(user):

View File

@@ -13,13 +13,16 @@ class Thread(object):
photo = str
#: The name of the thread
name = str
#: Timestamp of last message
last_message_timestamp = str
def __init__(self, _type, uid, photo=None, name=None):
def __init__(self, _type, uid, photo=None, name=None, last_message_timestamp=None):
"""Represents a Facebook thread"""
self.uid = str(uid)
self.type = _type
self.photo = photo
self.name = name
self.last_message_timestamp = last_message_timestamp
def __repr__(self):
return self.__unicode__()
@@ -125,8 +128,10 @@ class Message(object):
sticker = str
#: A list of attachments
attachments = list
#: An extensible attachment, e.g. share object
extensible_attachment = dict
def __init__(self, uid, author=None, timestamp=None, is_read=None, reactions=[], text=None, mentions=[], sticker=None, attachments=[]):
def __init__(self, uid, author=None, timestamp=None, is_read=None, reactions=[], text=None, mentions=[], sticker=None, attachments=[], extensible_attachment={}):
"""Represents a Facebook message"""
self.uid = uid
self.author = author
@@ -137,6 +142,7 @@ class Message(object):
self.mentions = mentions
self.sticker = sticker
self.attachments = attachments
self.extensible_attachment = extensible_attachment
class Mention(object):