Fixed some timezone problems
This commit is contained in:
pare
d4e3feaece
commit
fe4e01f90e
S'han modificat 2 arxius amb 46 adicions i 5 eliminacions
|
@ -328,7 +328,34 @@ Mention dicts
|
||||||
'acct': # Mentioned users account name (including domain)
|
'acct': # Mentioned users account name (including domain)
|
||||||
'id': # Mentioned users (local) account ID
|
'id': # Mentioned users (local) account ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scheduled toot dicts
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.. _scheduled toot dict:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
api2.status_post("text", scheduled_at=the_future)
|
||||||
|
# Returns the following dictionary:
|
||||||
|
{
|
||||||
|
'id': # Scheduled toot ID (note: Not the id of the toot once it gets posted!)
|
||||||
|
'scheduled_at': # datetime object describing when the toot is to be posted
|
||||||
|
'params': # Parameters for the scheduled toot, specifically
|
||||||
|
{
|
||||||
|
'text': # Toot text
|
||||||
|
'in_reply_to_id': # ID of the toot this one is a reply to
|
||||||
|
'media_ids': # IDs of media attached to this toot
|
||||||
|
'sensitive': # Whether this toot is sensitive or not
|
||||||
|
'visibility': # Visibility of the toot
|
||||||
|
'idempotency': # Idempotency key for the scheduled toot
|
||||||
|
'scheduled_at': # Present, but generally "None"
|
||||||
|
'spoiler_text': # CW text for this toot
|
||||||
|
'application_id': # ID of the application that scheduled the toot
|
||||||
|
'poll': # Poll parameters, as a poll dict
|
||||||
|
},
|
||||||
|
'media_attachments': # Array of media dicts for the attachments to the scheduled toot
|
||||||
|
}
|
||||||
|
|
||||||
Conversation dicts
|
Conversation dicts
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
.. _conversation dict:
|
.. _conversation dict:
|
||||||
|
|
|
@ -802,6 +802,18 @@ class Mastodon:
|
||||||
url = '/api/v1/statuses/{0}/favourited_by'.format(str(id))
|
url = '/api/v1/statuses/{0}/favourited_by'.format(str(id))
|
||||||
return self.__api_request('GET', url)
|
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
|
# Reading data: Notifications
|
||||||
###
|
###
|
||||||
|
@ -1358,7 +1370,7 @@ class Mastodon:
|
||||||
in_reply_to_id = self.__unpack_id(in_reply_to_id)
|
in_reply_to_id = self.__unpack_id(in_reply_to_id)
|
||||||
|
|
||||||
if scheduled_at != None:
|
if scheduled_at != None:
|
||||||
scheduled_at = scheduled_at.isoformat()
|
scheduled_at = scheduled_at.astimezone(pytz.utc).isoformat()
|
||||||
|
|
||||||
params_initial = locals()
|
params_initial = locals()
|
||||||
|
|
||||||
|
@ -1554,15 +1566,17 @@ class Mastodon:
|
||||||
# Writing data: Scheduled statuses
|
# Writing data: Scheduled statuses
|
||||||
###
|
###
|
||||||
@api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS)
|
@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.
|
Update the scheduled time of a scheduled status.
|
||||||
|
|
||||||
New time must be at least 5 minutes into the future.
|
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)
|
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))
|
url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
|
||||||
return self.__api_request('PUT', url, params)
|
return self.__api_request('PUT', url, params)
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència