kopia lustrzana https://github.com/halcy/Mastodon.py
Add support for public/remote stream
rodzic
39bdc5d10a
commit
39f1ee8889
|
@ -13,6 +13,7 @@ v1.8.1 (in progress)
|
|||
* Add readme to PyPi page (thanks hugovk)
|
||||
* Fix `list_accounts` to actually include request parameters (thanks leoncowle)
|
||||
* Small formatting changes (thanks amaargiru)
|
||||
* Add link to examples to docs and readme.
|
||||
|
||||
v1.8.0
|
||||
------
|
||||
|
|
|
@ -20,18 +20,28 @@ class Mastodon(Internals):
|
|||
return self.__stream('/api/v1/streaming/user', 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)
|
||||
def stream_public(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
||||
def stream_public(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC, local=False, remote=False):
|
||||
"""
|
||||
Streams public events.
|
||||
"""
|
||||
return self.__stream('/api/v1/streaming/public', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
|
||||
base = '/api/v1/streaming/public'
|
||||
if local:
|
||||
base += '/local'
|
||||
if remote:
|
||||
if local:
|
||||
raise MastodonIllegalArgumentError("Cannot pass both local and remote - use either one or the other.")
|
||||
base += '/remote'
|
||||
return self.__stream(base 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)
|
||||
def stream_local(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC):
|
||||
"""
|
||||
Streams local public events.
|
||||
|
||||
This function is deprecated. Please use :ref:`stream_public() <stream_public()>` with parameter `local` set to True instead.
|
||||
"""
|
||||
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)
|
||||
return self.stream_public(listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec, local=True)
|
||||
|
||||
@api_version("1.1.0", "1.4.2", _DICT_VERSION_STATUS)
|
||||
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):
|
||||
|
|
Ładowanie…
Reference in New Issue