aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/index.rst3
-rw-r--r--mastodon/Mastodon.py22
2 files changed, 15 insertions, 10 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 3dff97a..fe92636 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -585,7 +585,7 @@ will return a handle corresponding to the open connection. The
585connection may be closed at any time by calling the handles close() method, and the 585connection may be closed at any time by calling the handles close() method, and the
586status of the connection can be verified calling is_alive() on the handle. 586status of the connection can be verified calling is_alive() on the handle.
587 587
588The streaming functions take instances of `StreamListener` as a parameter. 588The streaming functions take instances of `StreamListener` as the `listener` parameter.
589A `CallbackStreamListener` class that allows you to specify function callbacks 589A `CallbackStreamListener` class that allows you to specify function callbacks
590directly is included for convenience. 590directly is included for convenience.
591 591
@@ -593,6 +593,7 @@ directly is included for convenience.
593.. automethod:: Mastodon.stream_public 593.. automethod:: Mastodon.stream_public
594.. automethod:: Mastodon.stream_local 594.. automethod:: Mastodon.stream_local
595.. automethod:: Mastodon.stream_hashtag 595.. automethod:: Mastodon.stream_hashtag
596.. automethod:: Mastodon.stream_list
596 597
597StreamListener 598StreamListener
598~~~~~~~~~~~~~~ 599~~~~~~~~~~~~~~
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 8130b2c..d8410b3 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1165,25 +1165,21 @@ class Mastodon:
1165 def stream_user(self, listener, async=False): 1165 def stream_user(self, listener, async=False):
1166 """ 1166 """
1167 Streams events that are relevant to the authorized user, i.e. home 1167 Streams events that are relevant to the authorized user, i.e. home
1168 timeline and notifications. 'listener' should be a subclass of 1168 timeline and notifications.
1169 StreamListener which will receive callbacks for incoming events.
1170 """ 1169 """
1171 return self.__stream('/api/v1/streaming/user', listener, async=async) 1170 return self.__stream('/api/v1/streaming/user', listener, async=async)
1172 1171
1173 @api_version("1.1.0") 1172 @api_version("1.1.0")
1174 def stream_public(self, listener, async=False): 1173 def stream_public(self, listener, async=False):
1175 """ 1174 """
1176 Streams public events. 'listener' should be a subclass of StreamListener 1175 Streams public events.
1177 which will receive callbacks for incoming events.
1178 """ 1176 """
1179 return self.__stream('/api/v1/streaming/public', listener, async=async) 1177 return self.__stream('/api/v1/streaming/public', listener, async=async)
1180 1178
1181 @api_version("1.1.0") 1179 @api_version("1.1.0")
1182 def stream_local(self, listener, async=False): 1180 def stream_local(self, listener, async=False):
1183 """ 1181 """
1184 Streams local events. 'listener' should be a subclass of StreamListener 1182 Streams local public events.
1185 which will receive callbacks for incoming events.
1186
1187 """ 1183 """
1188 return self.__stream('/api/v1/streaming/public/local', listener, async=async) 1184 return self.__stream('/api/v1/streaming/public/local', listener, async=async)
1189 1185
@@ -1191,13 +1187,21 @@ class Mastodon:
1191 def stream_hashtag(self, tag, listener, async=False): 1187 def stream_hashtag(self, tag, listener, async=False):
1192 """ 1188 """
1193 Stream for all public statuses for the hashtag 'tag' seen by the connected 1189 Stream for all public statuses for the hashtag 'tag' seen by the connected
1194 instance. 'listener' should be a subclass of StreamListener which will receive 1190 instance.
1195 callbacks for incoming events.
1196 """ 1191 """
1197 if tag.startswith("#"): 1192 if tag.startswith("#"):
1198 raise MastodonIllegalArgumentError("Tag parameter should omit leading #") 1193 raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
1199 return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener) 1194 return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener)
1200 1195
1196 @api_version("2.1.0")
1197 def stream_list(self, id, listener, async=False):
1198 """
1199 Stream events for the current user, restricted to accounts on the given
1200 list.
1201 """
1202 id = self.__unpack_id(id)
1203 return self.__stream("/api/v1/streaming/list?list={}".format(id), listener)
1204
1201 ### 1205 ###
1202 # Internal helpers, dragons probably 1206 # Internal helpers, dragons probably
1203 ### 1207 ###
Powered by cgit v1.2.3 (git 2.41.0)