From c06baa13b30fc5ce058940e681305f6c03dc0048 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 17:11:45 +0100 Subject: Update verify_credentials docs --- docs/index.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index dfd91ab..1d8f138 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -134,7 +134,7 @@ If you are only interested in the fact an error was raised somewhere in Mastodon.py, and not the details, this is the exception you can catch. `MastodonIllegalArgumentError` is generally a programming problem - you asked the -API to do something obviously invalid (i.e. specify a privacy scope that does +API to do something obviously invalid (i.e. specify a privacy option that does not exist). `MastodonFileNotFoundError` and `MastodonNetworkError` are IO errors - could be you @@ -176,8 +176,17 @@ User dicts 'header': # URL for their header image, can be animated 'avatar_static': # URL for their avatar, never animated 'header_static': # URL for their header image, never animated + 'source': # Additional information - only present for user dict returned from account_verify_credentials() } + mastodon.account_verify_credentials()["source"] + # Returns the following dictionary: + { + 'privacy': # The users default visibility setting ("private", "unlisted" or "public") + 'sensitive': # Denotes whether user media should be marked sensitive by default + 'note': # Plain text version of the users bio + } + Toot dicts ~~~~~~~~~~ .. code-block:: python -- cgit v1.2.3 From 75aebac744717216118afcdb89c96cfe8856e9ef Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 17:17:42 +0100 Subject: Add custom_emojis --- docs/index.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 1d8f138..3dff97a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -496,6 +496,11 @@ Reading data: Domain blocks .. automethod:: Mastodon.domain_blocks +Reading data: Emoji +------------------- + +.. automethod:: Mastodon.custom_emojis + Writing data: Statuses ---------------------- These functions allow you to post statuses to Mastodon and to -- cgit v1.2.3 From 7ed769b37a9fc27e36023370ad265380cbc50c52 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 17:26:44 +0100 Subject: Add list streaming --- docs/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 3dff97a..fe92636 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -585,7 +585,7 @@ will return a handle corresponding to the open connection. The connection may be closed at any time by calling the handles close() method, and the status of the connection can be verified calling is_alive() on the handle. -The streaming functions take instances of `StreamListener` as a parameter. +The streaming functions take instances of `StreamListener` as the `listener` parameter. A `CallbackStreamListener` class that allows you to specify function callbacks directly is included for convenience. @@ -593,6 +593,7 @@ directly is included for convenience. .. automethod:: Mastodon.stream_public .. automethod:: Mastodon.stream_local .. automethod:: Mastodon.stream_hashtag +.. automethod:: Mastodon.stream_list StreamListener ~~~~~~~~~~~~~~ -- cgit v1.2.3 From d7d8f153a31b76493daf68a44e01d4c4e11b180d Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 17:55:14 +0100 Subject: Update docs for search function --- docs/index.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index fe92636..da670b1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -340,6 +340,18 @@ Card dicts 'provider_url': # URL pointing to the embeds provider } +Search result dicts +~~~~~~~~~~~~~~~~~~~ +.. code-block:: python + + mastodon.search(...) + # Returns the folowing dictionary + { + 'accounts': # List of account dicts resulting from the query + 'hashtags': # List of hashtag dicts resulting from the query + 'statuses': # List of toot dicts resulting from the query + } + Instance dicts ~~~~~~~~~~~~~~ .. code-block:: python -- cgit v1.2.3 From 7d2f2441269fda71b72322825b5813a2aec4c7bd Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 18:40:17 +0100 Subject: Add internal links in docs --- docs/index.rst | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index da670b1..0c05321 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -156,6 +156,8 @@ and are parsed into python datetime objects. User dicts ~~~~~~~~~~ +.. _user dict: + .. code-block:: python mastodon.account() @@ -189,6 +191,8 @@ User dicts Toot dicts ~~~~~~~~~~ +.. _toot dict: + .. code-block:: python mastodon.toot("Hello from Python") @@ -222,6 +226,8 @@ Toot dicts Mention dicts ~~~~~~~~~~~~~ +.. _mention dict: + .. code-block:: python { @@ -233,6 +239,8 @@ Mention dicts Hashtag dicts ~~~~~~~~~~~~~ +.. _hashtag dict: + .. code-block:: python { @@ -242,6 +250,8 @@ Hashtag dicts Emoji dicts ~~~~~~~~~~~ +.. _emoji dict: + .. code-block:: python { @@ -252,6 +262,8 @@ Emoji dicts Relationship dicts ~~~~~~~~~~~~~~~~~~ +.. _relationship dict: + .. code-block:: python mastodon.account_follow() @@ -268,6 +280,8 @@ Relationship dicts Notification dicts ~~~~~~~~~~~~~~~~~~ +.. _notification dict: + .. code-block:: python mastodon.notifications()[0] @@ -283,6 +297,8 @@ Notification dicts Context dicts ~~~~~~~~~~~~~ +.. _context dict: + .. code-block:: python mastodon.status_context() @@ -294,6 +310,8 @@ Context dicts Media dicts ~~~~~~~~~~~ +.. _media dict: + .. code-block:: python mastodon.media_post("image.jpg", "image/jpeg") @@ -318,6 +336,8 @@ Media dicts Card dicts ~~~~~~~~~~ +.. _card dict: + .. code-block:: python mastodon.status_card(): @@ -342,9 +362,11 @@ Card dicts Search result dicts ~~~~~~~~~~~~~~~~~~~ +.. _search result dict: + .. code-block:: python - mastodon.search(...) + mastodon.search("") # Returns the folowing dictionary { 'accounts': # List of account dicts resulting from the query @@ -354,6 +376,8 @@ Search result dicts Instance dicts ~~~~~~~~~~~~~~ +.. _instance dict: + .. code-block:: python mastodon.instance() @@ -369,6 +393,8 @@ Instance dicts Report dicts ~~~~~~~~~~~~ +.. _report dict: + .. code-block:: python mastodon.reports()[0] @@ -404,6 +430,7 @@ is specified, Mastodon.py defaults to https. .. automethod:: Mastodon.create_app .. automethod:: Mastodon.__init__ +.. _log_in(): .. automethod:: Mastodon.log_in .. automethod:: Mastodon.auth_request_url @@ -434,10 +461,12 @@ Reading data: Timelines This function allows you to access the timelines a logged in user could see, as well as hashtag timelines and the public timeline. +.. _timeline(): .. automethod:: Mastodon.timeline .. automethod:: Mastodon.timeline_home .. automethod:: Mastodon.timeline_local .. automethod:: Mastodon.timeline_public +.. _timeline_hashtag(): .. automethod:: Mastodon.timeline_hashtag Reading data: Statuses @@ -518,6 +547,7 @@ Writing data: Statuses These functions allow you to post statuses to Mastodon and to interact with already posted statuses. +.. _status_post(): .. automethod:: Mastodon.status_post .. automethod:: Mastodon.toot .. automethod:: Mastodon.status_reblog @@ -562,6 +592,8 @@ This function allows you to upload media to Mastodon. The returned media IDs (Up to 4 at the same time) can then be used with post_status to attach media to statuses. +.. _media_post(): + .. automethod:: Mastodon.media_post Writing data: Reports -- cgit v1.2.3 From b840766ed77ea0cac84ada7cb27a9b23ffda0a09 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 21:16:02 +0100 Subject: Add more list endpoints --- docs/index.rst | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 0c05321..9496da6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -287,12 +287,12 @@ Notification dicts mastodon.notifications()[0] # Returns the following dictionary: { - 'id': # id of the notification. - 'type': # "mention", "reblog", "favourite" or "follow". - 'created_at': # The time the notification was created. - 'account': # User dict of the user from whom the notification originates. - 'status': # In case of "mention", the mentioning status. - # In case of reblog / favourite, the reblogged / favourited status. + 'id': # id of the notification + 'type': # "mention", "reblog", "favourite" or "follow" + 'created_at': # The time the notification was created + 'account': # User dict of the user from whom the notification originates + 'status': # In case of "mention", the mentioning status + # In case of reblog / favourite, the reblogged / favourited status } Context dicts @@ -308,6 +308,19 @@ Context dicts 'descendants': # A list of toot dicts } +List dicts +~~~~~~~~~~ +.. _list dict: + +.. code-block:: python + + mastodon.list() + # Returns the following dictionary: + { + 'id': # id of the list + 'title': # title of the list + } + Media dicts ~~~~~~~~~~~ .. _media dict: @@ -468,6 +481,7 @@ user could see, as well as hashtag timelines and the public timeline. .. automethod:: Mastodon.timeline_public .. _timeline_hashtag(): .. automethod:: Mastodon.timeline_hashtag +.. automethod:: Mastodon.timeline_list Reading data: Statuses ---------------------- -- cgit v1.2.3 From afaab2b8743a11f2a8567873df8ae6ed7873ebb5 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Wed, 13 Dec 2017 22:33:29 +0100 Subject: Document list endpoints --- docs/index.rst | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 9496da6..4dd6403 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -512,6 +512,14 @@ their relationships. .. automethod:: Mastodon.account_relationships .. automethod:: Mastodon.account_search +Reading data: Lists +------------------- +These functions allow you to view information about lists. + +.. automethod:: Mastodon.lists +.. automethod:: Mastodon.list +.. automethod:: Mastodon.list_accounts + Reading data: Follows --------------------- @@ -532,7 +540,6 @@ Reading data: Searching .. automethod:: Mastodon.search - Reading data: Mutes and blocks ------------------------------ These functions allow you to get information about accounts that are @@ -593,6 +600,19 @@ These functions allow you to interact with other accounts: To (un)follow and .. automethod:: Mastodon.account_unmute .. automethod:: Mastodon.account_update_credentials +Writing data: Lists +------------------- +These functions allow you to create, maintain and delete lists. + +When creating lists, note that (As of Mastodon 2.1.0), a user can only +have a maximum of 50 lists. + +.. automethod:: Mastodon.list_create +.. automethod:: Mastodon.list_update +.. automethod:: Mastodon.list_delete +.. automethod:: Mastodon.list_accounts_add +.. automethod:: Mastodon.list_accounts_delete + Writing data: Follow requests ----------------------------- These functions allow you to accept or reject incoming follow requests. -- cgit v1.2.3