aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-12-13 17:26:44 +0100
committerLorenz Diener <[email protected]>2017-12-13 17:26:44 +0100
commit7ed769b37a9fc27e36023370ad265380cbc50c52 (patch)
treefc77e0b010044eea0c607383e8c8db412147bac9 /mastodon/Mastodon.py
parent75aebac744717216118afcdb89c96cfe8856e9ef (diff)
downloadmastodon.py-7ed769b37a9fc27e36023370ad265380cbc50c52.tar.gz
Add list streaming
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py22
1 files changed, 13 insertions, 9 deletions
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)