diff options
author | Lorenz Diener <[email protected]> | 2017-12-11 16:23:22 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2017-12-11 16:23:22 +0100 |
commit | d28b5725f4d239dd7baad991cff287916cc2532e (patch) | |
tree | c2aa7c5b74010091fc77675be9ac83469a678c3a | |
parent | ce5b0ca5768c926f73434f157b19cc185471f1af (diff) | |
download | mastodon.py-d28b5725f4d239dd7baad991cff287916cc2532e.tar.gz |
Improve documentation
-rw-r--r-- | docs/index.rst | 25 |
1 files changed, 23 insertions, 2 deletions
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. | |||
98 | There are convenience functions available for fetching the previous and next page of | 98 | There are convenience functions available for fetching the previous and next page of |
99 | a paginated request as well as for fetching all pages starting from a first page. | 99 | a paginated request as well as for fetching all pages starting from a first page. |
100 | 100 | ||
101 | A note about IDs | 101 | Two notes about IDs |
102 | ---------------- | 102 | ------------------- |
103 | Mastodons API uses IDs in several places: User IDs, Toot IDs, ... | 103 | Mastodons API uses IDs in several places: User IDs, Toot IDs, ... |
104 | 104 | ||
105 | While debugging, it might be tempting to copy-paste in IDs from the | 105 | 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 | |||
107 | interface and in the URLs are not the same as the IDs used internally | 107 | interface and in the URLs are not the same as the IDs used internally |
108 | in the API, so don't do that. | 108 | in the API, so don't do that. |
109 | 109 | ||
110 | ID unpacking | ||
111 | ~~~~~~~~~~~~ | ||
112 | Wherever Mastodon.py expects an ID as a parameter, you can also pass a | ||
113 | dict that contains an id - this means that, for example, instead of saying | ||
114 | |||
115 | .. code-block:: python | ||
116 | |||
117 | mastodon.status_post("@somebody wow!", in_reply_to_id = toot["id"]) | ||
118 | |||
119 | you can also just write | ||
120 | |||
121 | .. code-block:: python | ||
122 | |||
123 | mastodon.status_post("@somebody wow!", in_reply_to_id = toot) | ||
124 | |||
125 | and everything will work as intended. | ||
126 | |||
110 | Error handling | 127 | Error handling |
111 | -------------- | 128 | -------------- |
112 | When Mastodon.py encounters an error, it will raise an exception, generally with | 129 | 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 | |||
377 | Mastodon.py re-check the server version or explicitly determine if a | 394 | Mastodon.py re-check the server version or explicitly determine if a |
378 | specific minimum Version is available. | 395 | specific minimum Version is available. |
379 | 396 | ||
397 | Note that the automatic version checks check for the version in which the | ||
398 | endpoint was first added, not the version in which it was last changed. The | ||
399 | latter check may be added to Mastodon.py at a later date. | ||
400 | |||
380 | .. automethod:: Mastodon.retrieve_mastodon_version | 401 | .. automethod:: Mastodon.retrieve_mastodon_version |
381 | .. automethod:: Mastodon.verify_minimum_version | 402 | .. automethod:: Mastodon.verify_minimum_version |
382 | 403 | ||