diff options
author | Lorenz Diener <[email protected]> | 2019-04-28 19:18:23 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-04-28 19:18:23 +0200 |
commit | fe4e01f90eb76f68719611042e575a4fff32f9d0 (patch) | |
tree | a68818e7782ac7d0fe6b59ad4611525b8d152386 /mastodon | |
parent | d4e3feaeceba098c07123269ce2422858ca59098 (diff) | |
download | mastodon.py-fe4e01f90eb76f68719611042e575a4fff32f9d0.tar.gz |
Fixed some timezone problems
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index d4c458f..97e8461 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -803,6 +803,18 @@ class Mastodon: | |||
803 | return self.__api_request('GET', url) | 803 | return self.__api_request('GET', url) |
804 | 804 | ||
805 | ### | 805 | ### |
806 | # Reading data: Scheduled statuses | ||
807 | ### | ||
808 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) | ||
809 | def scheduled_statuses(self): | ||
810 | """ | ||
811 | Fetch a list of scheduled statuses | ||
812 | |||
813 | Returns a list of `scheduled toot dicts`_. | ||
814 | """ | ||
815 | return self.__api_request('GET', '/api/v1/scheduled_statuses') | ||
816 | |||
817 | ### | ||
806 | # Reading data: Notifications | 818 | # Reading data: Notifications |
807 | ### | 819 | ### |
808 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION) | 820 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION) |
@@ -1358,7 +1370,7 @@ class Mastodon: | |||
1358 | in_reply_to_id = self.__unpack_id(in_reply_to_id) | 1370 | in_reply_to_id = self.__unpack_id(in_reply_to_id) |
1359 | 1371 | ||
1360 | if scheduled_at != None: | 1372 | if scheduled_at != None: |
1361 | scheduled_at = scheduled_at.isoformat() | 1373 | scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat() |
1362 | 1374 | ||
1363 | params_initial = locals() | 1375 | params_initial = locals() |
1364 | 1376 | ||
@@ -1554,15 +1566,17 @@ class Mastodon: | |||
1554 | # Writing data: Scheduled statuses | 1566 | # Writing data: Scheduled statuses |
1555 | ### | 1567 | ### |
1556 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) | 1568 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) |
1557 | def update_scheduled_status(self, id, scheduled_at): | 1569 | def scheduled_status_update(self, id, scheduled_at): |
1558 | """ | 1570 | """ |
1559 | Update the scheduled time of a scheduled status. | 1571 | Update the scheduled time of a scheduled status. |
1560 | 1572 | ||
1561 | New time must be at least 5 minutes into the future. | 1573 | New time must be at least 5 minutes into the future. |
1574 | |||
1575 | Returns a `scheduled toot dict`_ | ||
1562 | """ | 1576 | """ |
1563 | scheduled_at = scheduled_at.isoformat() | 1577 | scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat() |
1564 | id = self.__unpack_id(id) | 1578 | id = self.__unpack_id(id) |
1565 | self.__generate_params(locals(), ['id']) | 1579 | params = self.__generate_params(locals(), ['id']) |
1566 | url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) | 1580 | url = '/api/v1/scheduled_statuses/{0}'.format(str(id)) |
1567 | return self.__api_request('PUT', url, params) | 1581 | return self.__api_request('PUT', url, params) |
1568 | 1582 | ||