aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-12-14 13:29:42 +0100
committerLorenz Diener <[email protected]>2017-12-14 13:29:42 +0100
commit5a94c46bb47de3aeb44cbfabfa9b422310d57449 (patch)
treefd1ab714f9cb29f26e0d1be6e85d1f14001edd9f /docs/index.rst
parentaf81088fb08525e617b8f1fad7deeabc47588c10 (diff)
downloadmastodon.py-5a94c46bb47de3aeb44cbfabfa9b422310d57449.tar.gz
Change default version check behaviour
Diffstat (limited to 'docs/index.rst')
-rw-r--r--docs/index.rst30
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.
110ID unpacking 110ID unpacking
111~~~~~~~~~~~~ 111~~~~~~~~~~~~
112Wherever Mastodon.py expects an ID as a parameter, you can also pass a 112Wherever Mastodon.py expects an ID as a parameter, you can also pass a
113dict that contains an id - this means that, for example, instead of saying 113dict 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
156the JSON format used by the API. Dates returned by the API are in ISO 8601 format 156the JSON format used by the API. Dates returned by the API are in ISO 8601 format
157and are parsed into python datetime objects. 157and are parsed into python datetime objects.
158 158
159To make access easier, the dictionaries returned are wrapped by a class that adds
160read-only attributes for all dict values - this means that, for example, instead of
161writing
162
163.. code-block:: python
164
165 description = mastodon.account_verify_credentials()["source"]["note"]
166
167you can also just write
168
169.. code-block:: python
170
171 description = mastodon.account_verify_credentials().source.note
172
173and everything will work as intended.
174
175
159User dicts 176User 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
474Mastodon.py will check if a certain endpoint is available before doing API 493Mastodon.py will check if a certain endpoint is available before doing API
475calls. By default, it checks against the version of Mastodon retrieved on 494calls. By default, it checks against the version of Mastodon retrieved on
476init(), or the version you specified. Mastodon.py can be set (in the 495init(), or the version you specified. Mastodon.py can be set (in the
477constructor) to either check if an endpoint is available at all or to check 496constructor) to either check if an endpoint is available at all (this is the
478if the endpoint is available and behaves as in the newest Mastodon version 497default) 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. 498Mastodon version (with regards to parameters as well as return values).
480If a version check fails, Mastodon.py throws a `MastodonVersionError`. 499Version checking can also be disabled altogether. If a version check fails,
500Mastodon.py throws a `MastodonVersionError`.
481 501
482With the following functions, you can make Mastodon.py re-check the server 502With the following functions, you can make Mastodon.py re-check the server
483version or explicitly determine if a specific minimum Version is available. 503version or explicitly determine if a specific minimum Version is available.
Powered by cgit v1.2.3 (git 2.41.0)