diff options
-rw-r--r-- | DEVELOPMENT.md | 1 | ||||
-rw-r--r-- | docs/index.rst | 1 | ||||
-rw-r--r-- | mastodon/streaming.py | 7 |
3 files changed, 9 insertions, 0 deletions
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d52ce46..55070ac 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md | |||
@@ -4,6 +4,7 @@ Here's some general stuff to keep in mind, and some work that needs to be done | |||
4 | use requests over urllib, et cetera. | 4 | use requests over urllib, et cetera. |
5 | 5 | ||
6 | * Current TODOs: | 6 | * Current TODOs: |
7 | * Stream since_id and better resume | ||
7 | * Testing - test 2.3 stuff and verify it works, test pinning | 8 | * Testing - test 2.3 stuff and verify it works, test pinning |
8 | * 2.4 support: | 9 | * 2.4 support: |
9 | * Dict updates (bot flag, profile meta fields, ...?) | 10 | * Dict updates (bot flag, profile meta fields, ...?) |
diff --git a/docs/index.rst b/docs/index.rst index 55d4495..85b4b60 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -227,6 +227,7 @@ User dicts | |||
227 | # from account_verify_credentials() | 227 | # from account_verify_credentials() |
228 | 'moved_to_account': # If set, an account dict of the account this user has | 228 | 'moved_to_account': # If set, an account dict of the account this user has |
229 | # set up as their moved-to address. | 229 | # set up as their moved-to address. |
230 | 'bot': # Boolean indicating whether this account is automated. | ||
230 | } | 231 | } |
231 | 232 | ||
232 | mastodon.account_verify_credentials()["source"] | 233 | mastodon.account_verify_credentials()["source"] |
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 |