abstract client + fix getThreadList 'end'

This commit is contained in:
PidgeyL
2015-12-09 09:04:38 +01:00
parent 4924c7c2ef
commit 685897b190

View File

@@ -53,6 +53,7 @@ class Client(object):
self._session = requests.session() self._session = requests.session()
self.req_counter = 1; self.req_counter = 1;
self.payloadDefault={} self.payloadDefault={}
self.client = 'mercury'
if not user_agent: if not user_agent:
user_agent = choice(USER_AGENTS) user_agent = choice(USER_AGENTS)
@@ -188,7 +189,7 @@ class Client(object):
timestamp = now() timestamp = now()
date = datetime.now() date = datetime.now()
data = { data = {
'client' : 'mercury', 'client' : self.client,
'message_batch[0][action_type]' : 'ma-type:user-generated-message', 'message_batch[0][action_type]' : 'ma-type:user-generated-message',
'message_batch[0][author]' : 'fbid:' + str(self.uid), 'message_batch[0][author]' : 'fbid:' + str(self.uid),
'message_batch[0][specific_to_list][0]' : 'fbid:' + str(thread_id), 'message_batch[0][specific_to_list][0]' : 'fbid:' + str(thread_id),
@@ -224,13 +225,13 @@ class Client(object):
:param start: the start index of a thread :param start: the start index of a thread
:param end: (optional) the last index of a thread :param end: (optional) the last index of a thread
""" """
if not end: if not end: end = start + 20
end = start + 20 if end <= start: end=start+end
timestamp = now() timestamp = now()
date = datetime.now() date = datetime.now()
data = { data = {
'client' : 'web_messenger', 'client' : self.client,
'inbox[offset]' : start, 'inbox[offset]' : start,
'inbox[limit]' : end, 'inbox[limit]' : end,
} }