diff options
author | Lorenz Diener <[email protected]> | 2017-11-21 14:46:43 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2017-11-21 14:46:43 +0100 |
commit | 32f8b8bed9226f8069883d85e9d38d69f6a67910 (patch) | |
tree | 3389275a757aa3eb73883f3aca902762aaed9a07 /mastodon | |
parent | e1a1592575d2aa8d5d719269bca4ca3effc8dc31 (diff) | |
download | mastodon.py-32f8b8bed9226f8069883d85e9d38d69f6a67910.tar.gz |
Added support for local hashtag timelines
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 49d7e9b..0431068 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -236,9 +236,10 @@ class Mastodon: | |||
236 | ## | 236 | ## |
237 | def timeline(self, timeline="home", max_id=None, since_id=None, limit=None): | 237 | def timeline(self, timeline="home", max_id=None, since_id=None, limit=None): |
238 | """ | 238 | """ |
239 | Fetch statuses, most recent ones first. Timeline can be home, local, public, | 239 | Fetch statuses, most recent ones first. Timeline can be 'home', 'local', 'public', |
240 | or tag/hashtag. See the following functions documentation for what those do. | 240 | or 'tag/hashtag'. See the following functions documentation for what those do. |
241 | 241 | Local hashtag timelines are supported via the timeline_hashtag() function. | |
242 | |||
242 | The default timeline is the "home" timeline. | 243 | The default timeline is the "home" timeline. |
243 | 244 | ||
244 | Returns a list of toot dicts. | 245 | Returns a list of toot dicts. |
@@ -280,14 +281,21 @@ class Mastodon: | |||
280 | return self.timeline('public', max_id=max_id, since_id=since_id, | 281 | return self.timeline('public', max_id=max_id, since_id=since_id, |
281 | limit=limit) | 282 | limit=limit) |
282 | 283 | ||
283 | def timeline_hashtag(self, hashtag, max_id=None, since_id=None, limit=None): | 284 | def timeline_hashtag(self, hashtag, local=False, max_id=None, since_id=None, limit=None): |
284 | """ | 285 | """ |
285 | Fetch a timeline of toots with a given hashtag. | 286 | Fetch a timeline of toots with a given hashtag. |
286 | 287 | ||
287 | Returns a list of toot dicts. | 288 | Returns a list of toot dicts. |
288 | """ | 289 | """ |
289 | url = 'tag/{0}'.format(str(hashtag)) | 290 | params_initial = locals() |
290 | return self.timeline(url, max_id=max_id, since_id=since_id, limit=limit) | 291 | |
292 | if local == False: | ||
293 | del params_initial['local'] | ||
294 | |||
295 | url = '/api/v1/timelines/tag/{0}'.format(hashtag) | ||
296 | params = self.__generate_params(params_initial, ['hashtag']) | ||
297 | |||
298 | return self.__api_request('GET', url, params) | ||
291 | 299 | ||
292 | ### | 300 | ### |
293 | # Reading data: Statuses | 301 | # Reading data: Statuses |