aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/streaming.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mastodon/streaming.py b/mastodon/streaming.py
index 3fbd569..416f271 100644
--- a/mastodon/streaming.py
+++ b/mastodon/streaming.py
@@ -25,6 +25,11 @@ class StreamListener(object):
25 describing the notification.""" 25 describing the notification."""
26 pass 26 pass
27 27
28 def on_abort(self):
29 """Some error happened that requires that the connection should
30 be aborted (or re-established)"""
31 pass
32
28 def on_delete(self, status_id): 33 def on_delete(self, status_id):
29 """A status has been deleted. status_id is the status' integer ID.""" 34 """A status has been deleted. status_id is the status' integer ID."""
30 pass 35 pass
@@ -64,11 +69,13 @@ class StreamListener(object):
64 else: 69 else:
65 line_buffer.extend(chunk) 70 line_buffer.extend(chunk)
66 except ChunkedEncodingError as err: 71 except ChunkedEncodingError as err:
72 self.on_abort()
67 six.raise_from( 73 six.raise_from(
68 MastodonNetworkError("Server ceased communication."), 74 MastodonNetworkError("Server ceased communication."),
69 err 75 err
70 ) 76 )
71 except MastodonReadTimeout as err: 77 except MastodonReadTimeout as err:
78 self.on_abort()
72 six.raise_from( 79 six.raise_from(
73 MastodonReadTimeout("Timed out while reading from server."), 80 MastodonReadTimeout("Timed out while reading from server."),
74 err 81 err
Powered by cgit v1.2.3 (git 2.41.0)