aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-04-17 14:55:31 +0200
committerLorenz Diener <[email protected]>2018-04-17 14:55:31 +0200
commit6d4490295a7371da1939efd612f919b6ce6af3d3 (patch)
tree7b5957d6f987df2ba84b330f6db054454c4ffe9f /mastodon
parentd0ae9dcd055e3bdc96a5ab817d14cda012516297 (diff)
downloadmastodon.py-6d4490295a7371da1939efd612f919b6ce6af3d3.tar.gz
Nicen up reconnect waiting
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 933a6c5..595b79e 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -89,6 +89,7 @@ class Mastodon:
89 """ 89 """
90 __DEFAULT_BASE_URL = 'https://mastodon.social' 90 __DEFAULT_BASE_URL = 'https://mastodon.social'
91 __DEFAULT_TIMEOUT = 300 91 __DEFAULT_TIMEOUT = 300
92 __DEFAULT_STREAM_RECONNECT_WAIT_SEC = 5
92 __SUPPORTED_MASTODON_VERSION = "2.2.0" 93 __SUPPORTED_MASTODON_VERSION = "2.2.0"
93 94
94 ### 95 ###
@@ -1387,7 +1388,7 @@ class Mastodon:
1387 # Streaming 1388 # Streaming
1388 ### 1389 ###
1389 @api_version("1.1.0", "1.4.2") 1390 @api_version("1.1.0", "1.4.2")
1390 def stream_user(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1391 def stream_user(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1391 """ 1392 """
1392 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
1393 timeline and notifications. 1394 timeline and notifications.
@@ -1395,21 +1396,21 @@ class Mastodon:
1395 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, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1396 1397
1397 @api_version("1.1.0", "1.4.2") 1398 @api_version("1.1.0", "1.4.2")
1398 def stream_public(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1399 def stream_public(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1399 """ 1400 """
1400 Streams public events. 1401 Streams public events.
1401 """ 1402 """
1402 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, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1403 1404
1404 @api_version("1.1.0", "1.4.2") 1405 @api_version("1.1.0", "1.4.2")
1405 def stream_local(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1406 def stream_local(self, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1406 """ 1407 """
1407 Streams local public events. 1408 Streams local public events.
1408 """ 1409 """
1409 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, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1410 1411
1411 @api_version("1.1.0", "1.4.2") 1412 @api_version("1.1.0", "1.4.2")
1412 def stream_hashtag(self, tag, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1413 def stream_hashtag(self, tag, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1413 """ 1414 """
1414 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
1415 instance. 1416 instance.
@@ -1419,7 +1420,7 @@ class Mastodon:
1419 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, async=async, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
1420 1421
1421 @api_version("2.1.0", "2.1.0") 1422 @api_version("2.1.0", "2.1.0")
1422 def stream_list(self, id, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=5): 1423 def stream_list(self, id, listener, async=False, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
1423 """ 1424 """
1424 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
1425 list. 1426 list.
Powered by cgit v1.2.3 (git 2.41.0)