From fe4e01f90eb76f68719611042e575a4fff32f9d0 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sun, 28 Apr 2019 19:18:23 +0200 Subject: Fixed some timezone problems --- mastodon/Mastodon.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index d4c458f..97e8461 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -802,6 +802,18 @@ class Mastodon: url = '/api/v1/statuses/{0}/favourited_by'.format(str(id)) return self.__api_request('GET', url) + ### + # Reading data: Scheduled statuses + ### + @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) + def scheduled_statuses(self): + """ + Fetch a list of scheduled statuses + + Returns a list of `scheduled toot dicts`_. + """ + return self.__api_request('GET', '/api/v1/scheduled_statuses') + ### # Reading data: Notifications ### @@ -1358,7 +1370,7 @@ class Mastodon: in_reply_to_id = self.__unpack_id(in_reply_to_id) if scheduled_at != None: - scheduled_at = scheduled_at.isoformat() + scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat() params_initial = locals() @@ -1554,15 +1566,17 @@ class Mastodon: # Writing data: Scheduled statuses ### @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) - def update_scheduled_status(self, id, scheduled_at): + def scheduled_status_update(self, id, scheduled_at): """ Update the scheduled time of a scheduled status. New time must be at least 5 minutes into the future. + + Returns a `scheduled toot dict`_ """ - scheduled_at = scheduled_at.isoformat() + scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat() id = self.__unpack_id(id) - self.__generate_params(locals(), ['id']) + params = self.__generate_params(locals(), ['id']) url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) return self.__api_request('PUT', url, params) -- cgit v1.2.3