diff options
author | Lorenz Diener <[email protected]> | 2017-11-24 15:08:34 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2017-11-24 15:08:34 +0100 |
commit | e220e7cc60839ee1e3b27781b3b1cb609e593f85 (patch) | |
tree | 0575d9a30ad250247f7b3bb171cedfb0d4e8af60 /mastodon/Mastodon.py | |
parent | cea4d4251a0b998ae734811ee78651d60a138d3e (diff) | |
download | mastodon.py-e220e7cc60839ee1e3b27781b3b1cb609e593f85.tar.gz |
Many fixes for streaming stuff
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r-- | mastodon/Mastodon.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index c35ad2d..9b28861 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -17,10 +17,11 @@ import re | |||
17 | import copy | 17 | import copy |
18 | import threading | 18 | import threading |
19 | import sys | 19 | import sys |
20 | |||
20 | try: | 21 | try: |
21 | from urllib.parse import urlparse | 22 | from urllib.parse import urlparse |
22 | except ImportError: | 23 | except ImportError: |
23 | from urlparse import urlparse | 24 | from urlparse import urlparse |
24 | 25 | ||
25 | 26 | ||
26 | class Mastodon: | 27 | class Mastodon: |
@@ -1014,12 +1015,6 @@ class Mastodon: | |||
1014 | Streams events that are relevant to the authorized user, i.e. home | 1015 | Streams events that are relevant to the authorized user, i.e. home |
1015 | timeline and notifications. 'listener' should be a subclass of | 1016 | timeline and notifications. 'listener' should be a subclass of |
1016 | StreamListener which will receive callbacks for incoming events. | 1017 | StreamListener which will receive callbacks for incoming events. |
1017 | |||
1018 | If async is False, this method blocks forever. | ||
1019 | |||
1020 | If async is True, 'listener' will listen on another thread and this method | ||
1021 | will return a handle corresponding to the open connection. The | ||
1022 | connection may be closed at any time by calling its close() method. | ||
1023 | """ | 1018 | """ |
1024 | return self.__stream('/api/v1/streaming/user', listener, async=async) | 1019 | return self.__stream('/api/v1/streaming/user', listener, async=async) |
1025 | 1020 | ||
@@ -1027,12 +1022,6 @@ class Mastodon: | |||
1027 | """ | 1022 | """ |
1028 | Streams public events. 'listener' should be a subclass of StreamListener | 1023 | Streams public events. 'listener' should be a subclass of StreamListener |
1029 | which will receive callbacks for incoming events. | 1024 | which will receive callbacks for incoming events. |
1030 | |||
1031 | If async is False, this method blocks forever. | ||
1032 | |||
1033 | If async is True, 'listener' will listen on another thread and this method | ||
1034 | will return a handle corresponding to the open connection. The | ||
1035 | connection may be closed at any time by calling its close() method. | ||
1036 | """ | 1025 | """ |
1037 | return self.__stream('/api/v1/streaming/public', listener, async=async) | 1026 | return self.__stream('/api/v1/streaming/public', listener, async=async) |
1038 | 1027 | ||
@@ -1041,11 +1030,6 @@ class Mastodon: | |||
1041 | Streams local events. 'listener' should be a subclass of StreamListener | 1030 | Streams local events. 'listener' should be a subclass of StreamListener |
1042 | which will receive callbacks for incoming events. | 1031 | which will receive callbacks for incoming events. |
1043 | 1032 | ||
1044 | If async is False, this method blocks forever. | ||
1045 | |||
1046 | If async is True, 'listener' will listen on another thread and this method | ||
1047 | will return a handle corresponding to the open connection. The | ||
1048 | connection may be closed at any time by calling its close() method. | ||
1049 | """ | 1033 | """ |
1050 | return self.__stream('/api/v1/streaming/public/local', listener, async=async) | 1034 | return self.__stream('/api/v1/streaming/public/local', listener, async=async) |
1051 | 1035 | ||
@@ -1054,12 +1038,6 @@ class Mastodon: | |||
1054 | Returns all public statuses for the hashtag 'tag'. 'listener' should be | 1038 | Returns all public statuses for the hashtag 'tag'. 'listener' should be |
1055 | a subclass of StreamListener which will receive callbacks for incoming | 1039 | a subclass of StreamListener which will receive callbacks for incoming |
1056 | events. | 1040 | events. |
1057 | |||
1058 | If async is False, this method blocks forever. | ||
1059 | |||
1060 | If async is True, 'listener' will listen on another thread and this method | ||
1061 | will return a handle corresponding to the open connection. The | ||
1062 | connection may be closed at any time by calling its close() method. | ||
1063 | """ | 1041 | """ |
1064 | return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener) | 1042 | return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener) |
1065 | 1043 | ||