diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/docs/index.rst b/docs/index.rst index 4ef5102..9b6074d 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -110,7 +110,7 @@ in the API, so don't do that. | |||
110 | ID unpacking | 110 | ID unpacking |
111 | ~~~~~~~~~~~~ | 111 | ~~~~~~~~~~~~ |
112 | Wherever Mastodon.py expects an ID as a parameter, you can also pass a | 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 | 113 | dict that contains an id - this means that, for example, instead of writing |
114 | 114 | ||
115 | .. code-block:: python | 115 | .. code-block:: python |
116 | 116 | ||
@@ -156,6 +156,23 @@ Unless otherwise specified, all data is returned as python dictionaries, matchin | |||
156 | the JSON format used by the API. Dates returned by the API are in ISO 8601 format | 156 | the JSON format used by the API. Dates returned by the API are in ISO 8601 format |
157 | and are parsed into python datetime objects. | 157 | and are parsed into python datetime objects. |
158 | 158 | ||
159 | To make access easier, the dictionaries returned are wrapped by a class that adds | ||
160 | read-only attributes for all dict values - this means that, for example, instead of | ||
161 | writing | ||
162 | |||
163 | .. code-block:: python | ||
164 | |||
165 | description = mastodon.account_verify_credentials()["source"]["note"] | ||
166 | |||
167 | you can also just write | ||
168 | |||
169 | .. code-block:: python | ||
170 | |||
171 | description = mastodon.account_verify_credentials().source.note | ||
172 | |||
173 | and everything will work as intended. | ||
174 | |||
175 | |||
159 | User dicts | 176 | User dicts |
160 | ~~~~~~~~~~ | 177 | ~~~~~~~~~~ |
161 | .. _user dict: | 178 | .. _user dict: |
@@ -182,6 +199,8 @@ User dicts | |||
182 | 'header_static': # URL for their header image, never animated | 199 | 'header_static': # URL for their header image, never animated |
183 | 'source': # Additional information - only present for user dict returned | 200 | 'source': # Additional information - only present for user dict returned |
184 | # from account_verify_credentials() | 201 | # from account_verify_credentials() |
202 | 'moved_to_account': # If set, an account dict of the account this user has | ||
203 | # set up as their moved-to address. | ||
185 | } | 204 | } |
186 | 205 | ||
187 | mastodon.account_verify_credentials()["source"] | 206 | mastodon.account_verify_credentials()["source"] |
@@ -474,10 +493,11 @@ Versioning | |||
474 | Mastodon.py will check if a certain endpoint is available before doing API | 493 | Mastodon.py will check if a certain endpoint is available before doing API |
475 | calls. By default, it checks against the version of Mastodon retrieved on | 494 | calls. By default, it checks against the version of Mastodon retrieved on |
476 | init(), or the version you specified. Mastodon.py can be set (in the | 495 | init(), or the version you specified. Mastodon.py can be set (in the |
477 | constructor) to either check if an endpoint is available at all or to check | 496 | constructor) to either check if an endpoint is available at all (this is the |
478 | if the endpoint is available and behaves as in the newest Mastodon version | 497 | default) or to check if the endpoint is available and behaves as in the newest |
479 | (this is the default). Version checking can also be disabled altogether. | 498 | Mastodon version (with regards to parameters as well as return values). |
480 | If a version check fails, Mastodon.py throws a `MastodonVersionError`. | 499 | Version checking can also be disabled altogether. If a version check fails, |
500 | Mastodon.py throws a `MastodonVersionError`. | ||
481 | 501 | ||
482 | With the following functions, you can make Mastodon.py re-check the server | 502 | With the following functions, you can make Mastodon.py re-check the server |
483 | version or explicitly determine if a specific minimum Version is available. | 503 | version or explicitly determine if a specific minimum Version is available. |