aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 3706008..5f1edb3 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1388,45 +1388,45 @@ class Mastodon:
1388 # Streaming 1388 # Streaming
1389 ### 1389 ###
1390 @api_version("1.1.0", "1.4.2") 1390 @api_version("1.1.0", "1.4.2")
1391 def stream_user(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC): 1391 def stream_user(self, listener, run_async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1392 """ 1392 """
1393 Streams events that are relevant to the authorized user, i.e. home 1393 Streams events that are relevant to the authorized user, i.e. home
1394 timeline and notifications. 1394 timeline and notifications.
1395 """ 1395 """
1396 return self.__stream('/api/v1/streaming/user', listener, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) 1396 return self.__stream('/api/v1/streaming/user', listener, run_async=run_async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1397 1397
1398 @api_version("1.1.0", "1.4.2") 1398 @api_version("1.1.0", "1.4.2")
1399 def stream_public(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC): 1399 def stream_public(self, listener, run_async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1400 """ 1400 """
1401 Streams public events. 1401 Streams public events.
1402 """ 1402 """
1403 return self.__stream('/api/v1/streaming/public', listener, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) 1403 return self.__stream('/api/v1/streaming/public', listener, run_async=run_async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1404 1404
1405 @api_version("1.1.0", "1.4.2") 1405 @api_version("1.1.0", "1.4.2")
1406 def stream_local(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC): 1406 def stream_local(self, listener, run_async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1407 """ 1407 """
1408 Streams local public events. 1408 Streams local public events.
1409 """ 1409 """
1410 return self.__stream('/api/v1/streaming/public/local', listener, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) 1410 return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1411 1411
1412 @api_version("1.1.0", "1.4.2") 1412 @api_version("1.1.0", "1.4.2")
1413 def stream_hashtag(self, tag, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC): 1413 def stream_hashtag(self, tag, listener, run_async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1414 """ 1414 """
1415 Stream for all public statuses for the hashtag 'tag' seen by the connected 1415 Stream for all public statuses for the hashtag 'tag' seen by the connected
1416 instance. 1416 instance.
1417 """ 1417 """
1418 if tag.startswith("#"): 1418 if tag.startswith("#"):
1419 raise MastodonIllegalArgumentError("Tag parameter should omit leading #") 1419 raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
1420 return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) 1420 return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, run_async=run_async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1421 1421
1422 @api_version("2.1.0", "2.1.0") 1422 @api_version("2.1.0", "2.1.0")
1423 def stream_list(self, id, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC): 1423 def stream_list(self, id, listener, run_async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1424 """ 1424 """
1425 Stream events for the current user, restricted to accounts on the given 1425 Stream events for the current user, restricted to accounts on the given
1426 list. 1426 list.
1427 """ 1427 """
1428 id = self.__unpack_id(id) 1428 id = self.__unpack_id(id)
1429 return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) 1429 return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, run_async=run_async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1430 1430
1431 ### 1431 ###
1432 # Internal helpers, dragons probably 1432 # Internal helpers, dragons probably
@@ -1668,7 +1668,7 @@ class Mastodon:
1668 1668
1669 return response 1669 return response
1670 1670
1671 def __stream(self, endpoint, listener, params={}, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1671 def __stream(self, endpoint, listener, params={}, run_async=False, reconnect_async=False, reconnect_async_wait_sec=5):
1672 """ 1672 """
1673 Internal streaming API helper. 1673 Internal streaming API helper.
1674 1674
@@ -1765,7 +1765,7 @@ class Mastodon:
1765 self.running = False 1765 self.running = False
1766 return 0 1766 return 0
1767 1767
1768 if async: 1768 if run_async:
1769 handle = __stream_handle(connection, connect_func, reconnect_async, reconnect_async_wait_sec) 1769 handle = __stream_handle(connection, connect_func, reconnect_async, reconnect_async_wait_sec)
1770 t = threading.Thread(args=(), daemon = True, target=handle._threadproc) 1770 t = threading.Thread(args=(), daemon = True, target=handle._threadproc)
1771 t.start() 1771 t.start()
Powered by cgit v1.2.3 (git 2.41.0)