Improve documentation

This commit is contained in:
Lorenz Diener 2017-12-11 16:23:22 +01:00
pare ce5b0ca576
commit d28b5725f4

Veure arxiu

@ -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