Merge pull request #121 from joyeusenoelle/patch-1

Update Mastodon.py documentation for status_post()
pull/124/head
Lorenz Diener 2018-02-02 23:31:44 +01:00 zatwierdzone przez GitHub
commit ac0edd022f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -893,9 +893,12 @@ class Mastodon:
sensitive=False, visibility='', spoiler_text=None): sensitive=False, visibility='', spoiler_text=None):
""" """
Post a status. Can optionally be in reply to another status and contain Post a status. Can optionally be in reply to another status and contain
up to four pieces of media (Uploaded via `media_post()`_). media_ids can media.
also be the `media dicts`_ returned by `media_post()`_ - they are unpacked
automatically. `media_ids` should be a list. (If it's not, the function will turn it
into one.) It can contain up to four pieces of media (uploaded via
`media_post()`_). `media_ids` can also be the `media dicts`_ returned
by `media_post()`_ - they are unpacked automatically.
The `sensitive` boolean decides whether or not media attached to the post The `sensitive` boolean decides whether or not media attached to the post
should be marked as sensitive, which hides it by default on the Mastodon should be marked as sensitive, which hides it by default on the Mastodon
@ -936,6 +939,8 @@ class Mastodon:
if media_ids is not None: if media_ids is not None:
try: try:
media_ids_proper = [] media_ids_proper = []
if not isinstance(media_ids, (list, tuple)):
media_ids = [media_ids]
for media_id in media_ids: for media_id in media_ids:
if isinstance(media_id, dict): if isinstance(media_id, dict):
media_ids_proper.append(media_id["id"]) media_ids_proper.append(media_id["id"])