diff options
author | Erin Congden <[email protected]> | 2017-04-02 10:35:42 -0700 |
---|---|---|
committer | Erin Congden <[email protected]> | 2017-04-02 21:25:11 -0700 |
commit | 9eaf955bfc8bda2a2e114721347f9b2ccf06b055 (patch) | |
tree | b18cb111df9c4c6bf0cacc9f0077d2c7a1e8e05a /mastodon | |
parent | f734a45fb667baf40d2cae3696934f91f1d5d8d0 (diff) | |
download | mastodon.py-9eaf955bfc8bda2a2e114721347f9b2ccf06b055.tar.gz |
Added local timeline support
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 1d0e69f..641c415 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -162,14 +162,20 @@ class Mastodon: | |||
162 | ## | 162 | ## |
163 | def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None): | 163 | def timeline(self, timeline = "home", max_id = None, since_id = None, limit = None): |
164 | """ | 164 | """ |
165 | Fetch statuses, most recent ones first. Timeline can be home, mentions, public | 165 | Fetch statuses, most recent ones first. Timeline can be home, mentions, local, |
166 | or tag/hashtag. See the following functions documentation for what those do. | 166 | public, or tag/hashtag. See the following functions documentation for what those do. |
167 | 167 | ||
168 | The default timeline is the "home" timeline. | 168 | The default timeline is the "home" timeline. |
169 | 169 | ||
170 | Returns a list of toot dicts. | 170 | Returns a list of toot dicts. |
171 | """ | 171 | """ |
172 | params = self.__generate_params(locals(), ['timeline']) | 172 | params_initial = locals() |
173 | |||
174 | if timeline == "local": | ||
175 | timeline = "public" | ||
176 | params_initial['local'] = True | ||
177 | |||
178 | params = self.__generate_params(params_initial, ['timeline']) | ||
173 | return self.__api_request('GET', '/api/v1/timelines/' + timeline, params) | 179 | return self.__api_request('GET', '/api/v1/timelines/' + timeline, params) |
174 | 180 | ||
175 | def timeline_home(self, max_id = None, since_id = None, limit = None): | 181 | def timeline_home(self, max_id = None, since_id = None, limit = None): |
@@ -188,6 +194,14 @@ class Mastodon: | |||
188 | """ | 194 | """ |
189 | return self.timeline('mentions', max_id = max_id, since_id = since_id, limit = limit) | 195 | return self.timeline('mentions', max_id = max_id, since_id = since_id, limit = limit) |
190 | 196 | ||
197 | def timeline_local(self, max_id = None, since_id = None, limit = None): | ||
198 | """ | ||
199 | Fetches the local / instance-wide timeline. | ||
200 | |||
201 | Returns a list of toot dicts. | ||
202 | """ | ||
203 | return self.timeline('local', max_id = max_id, since_id = since_id, limit = limit) | ||
204 | |||
191 | def timeline_public(self, max_id = None, since_id = None, limit = None): | 205 | def timeline_public(self, max_id = None, since_id = None, limit = None): |
192 | """ | 206 | """ |
193 | Fetches the public / visible-network timeline. | 207 | Fetches the public / visible-network timeline. |