diff options
author | Lorenz Diener <[email protected]> | 2019-04-27 17:21:46 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2019-04-27 17:21:46 +0200 |
commit | 28ba394cb9f24cc550b33f41b32ebee727b10223 (patch) | |
tree | 64faf4c30ab976d3dd96516565280fd3153bbd5e | |
parent | a264154073dc59b89cd37887de33da45f96ca026 (diff) | |
parent | 1041db3b95db8d9484eefcdb1ab205cfe8aa5a43 (diff) | |
download | mastodon.py-28ba394cb9f24cc550b33f41b32ebee727b10223.tar.gz |
Merge pull request #161 from codl/doc-ratelimit
document rate limiting attributes
-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 | ----------------------- |