diff options
author | codl <[email protected]> | 2019-03-11 14:10:44 +0100 |
---|---|---|
committer | codl <[email protected]> | 2019-03-11 14:10:44 +0100 |
commit | 1041db3b95db8d9484eefcdb1ab205cfe8aa5a43 (patch) | |
tree | f201436acba2210843095a7d496a1fba5ba1a593 /docs | |
parent | 8b8626978752baf14347498640b2319db832145e (diff) | |
download | mastodon.py-1041db3b95db8d9484eefcdb1ab205cfe8aa5a43.tar.gz |
document rate limiting attributes
p sure the thing about editing them was actually wrong since they get
updated on every request
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/docs/index.rst b/docs/index.rst index 808e563..515e427 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -71,6 +71,26 @@ for applications that need to handle all rate limiting themselves (i.e. interact | |||
71 | or applications wanting to use Mastodon.py in a multi-threaded context ("wait" and "pace" | 71 | or applications wanting to use Mastodon.py in a multi-threaded context ("wait" and "pace" |
72 | modes are not thread safe). | 72 | modes are not thread safe). |
73 | 73 | ||
74 | .. note:: | ||
75 | Rate limit information is available on the `Mastodon` object for applications that | ||
76 | implement their own rate limit handling. | ||
77 | |||
78 | .. attribute:: Mastodon.ratelimit_remaining | ||
79 | |||
80 | Number of requests allowed until the next reset. | ||
81 | |||
82 | .. attribute:: Mastodon.ratelimit_reset | ||
83 | |||
84 | Time at which the rate limit will next be reset, as a POSIX timestamp. | ||
85 | |||
86 | .. attribute:: Mastodon.ratelimit_limit | ||
87 | |||
88 | Total number of requests allowed between resets. Typically 300. | ||
89 | |||
90 | .. attribute:: Mastodon.ratelimit_lastcall | ||
91 | |||
92 | Time at which these values have last been seen and updated, as a POSIX timestamp. | ||
93 | |||
74 | In "wait" mode, once a request hits the rate limit, Mastodon.py will wait until | 94 | In "wait" mode, once a request hits the rate limit, Mastodon.py will wait until |
75 | the rate limit resets and then try again, until the request succeeds or an error | 95 | the rate limit resets and then try again, until the request succeeds or an error |
76 | is encountered. This mode is for applications that would rather just not worry about rate limits | 96 | is encountered. This mode is for applications that would rather just not worry about rate limits |
@@ -91,9 +111,8 @@ minute time slot, and tighter limits on logins. Mastodon.py does not make any ef | |||
91 | to respect these. | 111 | to respect these. |
92 | 112 | ||
93 | If your application requires many hits to endpoints that are available without logging | 113 | If your application requires many hits to endpoints that are available without logging |
94 | in, do consider using Mastodon.py without authenticating to get the full per-IP limit. In | 114 | in, do consider using Mastodon.py without authenticating to get the full per-IP limit. |
95 | this case, you can set the Mastodon objects `ratelimit_limit` and `ratelimit_remaining` | 115 | |
96 | properties appropriately if you want to use advanced rate limit handling. | ||
97 | 116 | ||
98 | A note about pagination | 117 | A note about pagination |
99 | ----------------------- | 118 | ----------------------- |