From d28b5725f4d239dd7baad991cff287916cc2532e Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Mon, 11 Dec 2017 16:23:22 +0100 Subject: Improve documentation --- docs/index.rst | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 9c669d5..dfd91ab 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -98,8 +98,8 @@ next page) item of the returned list as _pagination_prev and _pagination_next. There are convenience functions available for fetching the previous and next page of a paginated request as well as for fetching all pages starting from a first page. -A note about IDs ----------------- +Two notes about IDs +------------------- Mastodons API uses IDs in several places: User IDs, Toot IDs, ... While debugging, it might be tempting to copy-paste in IDs from the @@ -107,6 +107,23 @@ web interface into your code. This will not work, as the IDs on the web interface and in the URLs are not the same as the IDs used internally in the API, so don't do that. +ID unpacking +~~~~~~~~~~~~ +Wherever Mastodon.py expects an ID as a parameter, you can also pass a +dict that contains an id - this means that, for example, instead of saying + +.. code-block:: python + + mastodon.status_post("@somebody wow!", in_reply_to_id = toot["id"]) + +you can also just write + +.. code-block:: python + + mastodon.status_post("@somebody wow!", in_reply_to_id = toot) + +and everything will work as intended. + Error handling -------------- When Mastodon.py encounters an error, it will raise an exception, generally with @@ -377,6 +394,10 @@ init(), or the version you specified. With these functions, you can make Mastodon.py re-check the server version or explicitly determine if a specific minimum Version is available. +Note that the automatic version checks check for the version in which the +endpoint was first added, not the version in which it was last changed. The +latter check may be added to Mastodon.py at a later date. + .. automethod:: Mastodon.retrieve_mastodon_version .. automethod:: Mastodon.verify_minimum_version -- cgit v1.2.3