Add local hashtag streaming
This commit is contained in:
pare
9129a65b88
commit
903068887e
S'han modificat 1 arxius amb 7 adicions i 2 eliminacions
|
@ -2504,14 +2504,19 @@ class Mastodon:
|
||||||
return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
|
return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
|
||||||
|
|
||||||
@api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS)
|
@api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS)
|
||||||
def stream_hashtag(self, tag, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
def stream_hashtag(self, tag, listener, local=False, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
||||||
"""
|
"""
|
||||||
Stream for all public statuses for the hashtag 'tag' seen by the connected
|
Stream for all public statuses for the hashtag 'tag' seen by the connected
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
|
Set local to True to only get local statuses.
|
||||||
"""
|
"""
|
||||||
if tag.startswith("#"):
|
if tag.startswith("#"):
|
||||||
raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
|
raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
|
||||||
return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
|
base = '/api/v1/streaming/hashtag'
|
||||||
|
if local:
|
||||||
|
base += '/local'
|
||||||
|
return self.__stream("{}?tag={}".format(base, tag), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
|
||||||
|
|
||||||
@api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS)
|
@api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS)
|
||||||
def stream_list(self, id, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
def stream_list(self, id, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
||||||
|
|
Loading…
Referencia en una nova incidència