Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0661367ebb | ||
|
3c07e42ba2 | ||
|
2cd6376818 | ||
|
5e7f7750de | ||
|
2a223ec6db | ||
|
637319ec2c |
@@ -17,7 +17,7 @@ from .client import *
|
|||||||
|
|
||||||
|
|
||||||
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
|
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
|
||||||
__version__ = '1.0.13'
|
__version__ = '1.0.17'
|
||||||
__license__ = 'BSD'
|
__license__ = 'BSD'
|
||||||
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
|
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
|
||||||
__email__ = 'carpedm20@gmail.com'
|
__email__ = 'carpedm20@gmail.com'
|
||||||
|
@@ -831,6 +831,13 @@ class Client(object):
|
|||||||
except (KeyError, IndexError) as e:
|
except (KeyError, IndexError) as e:
|
||||||
raise Exception('Error when sending message: No message IDs could be found: {}'.format(j))
|
raise Exception('Error when sending message: No message IDs could be found: {}'.format(j))
|
||||||
|
|
||||||
|
# update JS token if receive from response
|
||||||
|
if ('jsmods' in j) and ('require' in j['jsmods']):
|
||||||
|
try:
|
||||||
|
self.payloadDefault['fb_dtsg'] = j['jsmods']['require'][0][3][0]
|
||||||
|
except (KeyError, IndexError) as e:
|
||||||
|
log.warning("Error when update fb_dtsg. Facebook might have changed protocol.")
|
||||||
|
|
||||||
return message_id
|
return message_id
|
||||||
|
|
||||||
def sendMessage(self, message, thread_id=None, thread_type=ThreadType.USER):
|
def sendMessage(self, message, thread_id=None, thread_type=ThreadType.USER):
|
||||||
@@ -943,7 +950,7 @@ class Client(object):
|
|||||||
"""
|
"""
|
||||||
Sends a local image to a thread
|
Sends a local image to a thread
|
||||||
|
|
||||||
:param image_path: URL of an image to upload and send
|
:param image_path: Path of an image to upload and send
|
||||||
:param message: Additional message
|
:param message: Additional message
|
||||||
:param thread_id: User/Group ID to send to. See :ref:`intro_threads`
|
:param thread_id: User/Group ID to send to. See :ref:`intro_threads`
|
||||||
:param thread_type: See :ref:`intro_threads`
|
:param thread_type: See :ref:`intro_threads`
|
||||||
|
@@ -47,17 +47,18 @@ def get_customization_info(thread):
|
|||||||
for k in info.get('participant_customizations', []):
|
for k in info.get('participant_customizations', []):
|
||||||
rtn['nicknames'][k['participant_id']] = k.get('nickname')
|
rtn['nicknames'][k['participant_id']] = k.get('nickname')
|
||||||
elif info.get('participant_customizations'):
|
elif info.get('participant_customizations'):
|
||||||
_id = thread.get('thread_key', {}).get('other_user_id') or thread.get('id')
|
uid = thread.get('thread_key', {}).get('other_user_id') or thread.get('id')
|
||||||
if info['participant_customizations'][0]['participant_id'] == _id:
|
pc = info['participant_customizations']
|
||||||
rtn['nickname'] = info['participant_customizations'][0]
|
if len(pc) > 0:
|
||||||
if len(info['participant_customizations']) > 1:
|
if pc[0].get('participant_id') == uid:
|
||||||
rtn['own_nickname'] = info['participant_customizations'][1]
|
rtn['nickname'] = pc[0].get('nickname')
|
||||||
elif info['participant_customizations'][1]['participant_id'] == _id:
|
|
||||||
rtn['nickname'] = info['participant_customizations'][1]
|
|
||||||
if len(info['participant_customizations']) > 1:
|
|
||||||
rtn['own_nickname'] = info['participant_customizations'][0]
|
|
||||||
else:
|
else:
|
||||||
raise Exception('No participant matching the user {} found: {}'.format(_id, info['participant_customizations']))
|
rtn['own_nickname'] = pc[0].get('nickname')
|
||||||
|
if len(pc) > 1:
|
||||||
|
if pc[1].get('participant_id') == uid:
|
||||||
|
rtn['nickname'] = pc[1].get('nickname')
|
||||||
|
else:
|
||||||
|
rtn['own_nickname'] = pc[1].get('nickname')
|
||||||
return rtn
|
return rtn
|
||||||
|
|
||||||
def graphql_to_message(message):
|
def graphql_to_message(message):
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
requests
|
requests
|
||||||
lxml
|
lxml
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
|
enum34
|
||||||
|
Reference in New Issue
Block a user