diff options
author | Lorenz Diener <[email protected]> | 2017-11-27 13:50:31 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-27 13:50:31 +0100 |
commit | 32adb8ce4b8f1987cf99f01635d195d6ead5483d (patch) | |
tree | 89fda539c53ade48fce226b6cf67daa136f03b4c | |
parent | 52d57d9d435ad0032648835150aacda7fbc1f91c (diff) | |
parent | 3faf7c6473ab22dd98b53fcecfd0b7e772aa8699 (diff) | |
download | mastodon.py-32adb8ce4b8f1987cf99f01635d195d6ead5483d.tar.gz |
Merge pull request #103 from Kjwon15/feature-asyncstream
Implement is_alive to async stream
-rw-r--r-- | mastodon/Mastodon.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index c4e50f3..91e6b11 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -1306,7 +1306,11 @@ class Mastodon: | |||
1306 | def close(self): | 1306 | def close(self): |
1307 | self.connection.close() | 1307 | self.connection.close() |
1308 | 1308 | ||
1309 | def is_alive(self): | ||
1310 | return self._thread.is_alive() | ||
1311 | |||
1309 | def _threadproc(self): | 1312 | def _threadproc(self): |
1313 | self._thread = threading.current_thread() | ||
1310 | with closing(connection) as r: | 1314 | with closing(connection) as r: |
1311 | try: | 1315 | try: |
1312 | listener.handle_stream(r.iter_lines()) | 1316 | listener.handle_stream(r.iter_lines()) |