aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoĆ«lle Anthony <[email protected]>2018-02-02 13:46:47 -0500
committerGitHub <[email protected]>2018-02-02 13:46:47 -0500
commitdd587bb40300d247e9609f043339c51371463ade (patch)
tree82974fac6e8f933097d3aea86562676099e32a6a /mastodon/Mastodon.py
parent83daab6e31613f8a8c8cb8eac78abde074ab7dc1 (diff)
downloadmastodon.py-dd587bb40300d247e9609f043339c51371463ade.tar.gz
Update Mastodon.py
Modified docstring slightly; added type checking for media_ids in the status_post() method. If media_ids is not a list or tuple, put it into a list before parsing it.
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index ffaf32e..874d925 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -895,10 +895,10 @@ class Mastodon:
895 Post a status. Can optionally be in reply to another status and contain 895 Post a status. Can optionally be in reply to another status and contain
896 media. 896 media.
897 897
898 `media_ids` must be a list (even if you're only attaching one item). It 898 `media_ids` should be a list. (If it's not, the function will turn it
899 can contain up to four pieces of media (uploaded via `media_post()`_). 899 into one.) It can contain up to four pieces of media (uploaded via
900 `media_ids` can also be the `media dicts`_ returned by `media_post()`_ - 900 `media_post()`_). `media_ids` can also be the `media dicts`_ returned
901 they are unpacked automatically. 901 by `media_post()`_ - they are unpacked automatically.
902 902
903 The `sensitive` boolean decides whether or not media attached to the post 903 The `sensitive` boolean decides whether or not media attached to the post
904 should be marked as sensitive, which hides it by default on the Mastodon 904 should be marked as sensitive, which hides it by default on the Mastodon
@@ -939,6 +939,8 @@ class Mastodon:
939 if media_ids is not None: 939 if media_ids is not None:
940 try: 940 try:
941 media_ids_proper = [] 941 media_ids_proper = []
942 if not isinstance(media_ids, (list, tuple)):
943 media_ids = [media_ids]
942 for media_id in media_ids: 944 for media_id in media_ids:
943 if isinstance(media_id, dict): 945 if isinstance(media_id, dict):
944 media_ids_proper.append(media_id["id"]) 946 media_ids_proper.append(media_id["id"])
Powered by cgit v1.2.3 (git 2.41.0)