Deprecate markAlive parameter in doOneListen and _pullMessage

This commit is contained in:
Kacper Ziubryniewicz
2019-01-05 18:48:40 +01:00
parent c357fd085b
commit e80a040db4

View File

@@ -2072,7 +2072,7 @@ class Client(object):
} }
self._get(self.req_url.PING, data, fix_request=True, as_json=False) self._get(self.req_url.PING, data, fix_request=True, as_json=False)
def _pullMessage(self, markAlive=True): def _pullMessage(self):
"""Call pull api with seq value to get message data.""" """Call pull api with seq value to get message data."""
data = { data = {
@@ -2080,7 +2080,7 @@ class Client(object):
"sticky_token": self.sticky, "sticky_token": self.sticky,
"sticky_pool": self.pool, "sticky_pool": self.pool,
"clientid": self.client_id, "clientid": self.client_id,
'state': 'active' if markAlive else 'offline', 'state': 'active' if self._markAlive else 'offline',
} }
j = self._get(self.req_url.STICKY, data, fix_request=True, as_json=True) j = self._get(self.req_url.STICKY, data, fix_request=True, as_json=True)
@@ -2545,22 +2545,22 @@ class Client(object):
""" """
self.listening = True self.listening = True
def doOneListen(self, markAlive=None): def doOneListen(self):
""" """
Does one cycle of the listening loop. Does one cycle of the listening loop.
This method is useful if you want to control fbchat from an external event loop This method is useful if you want to control fbchat from an external event loop
:param markAlive: Whether this should ping the Facebook server before running .. warning::
:type markAlive: bool `markAlive` parameter is deprecated now, use :func:`fbchat.Client.setActiveStatus`
or `markAlive` parameter in :func:`fbchat.Client.listen` instead.
:return: Whether the loop should keep running :return: Whether the loop should keep running
:rtype: bool :rtype: bool
""" """
if markAlive is None:
markAlive = self._markAlive
try: try:
if markAlive: if self._markAlive:
self._ping() self._ping()
content = self._pullMessage(markAlive) content = self._pullMessage()
if content: if content:
self._parseMessage(content) self._parseMessage(content)
except KeyboardInterrupt: except KeyboardInterrupt: