From 1041db3b95db8d9484eefcdb1ab205cfe8aa5a43 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 11 Mar 2019 14:10:44 +0100 Subject: document rate limiting attributes p sure the thing about editing them was actually wrong since they get updated on every request --- docs/index.rst | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'docs') 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 or applications wanting to use Mastodon.py in a multi-threaded context ("wait" and "pace" modes are not thread safe). +.. note:: + Rate limit information is available on the `Mastodon` object for applications that + implement their own rate limit handling. + + .. attribute:: Mastodon.ratelimit_remaining + + Number of requests allowed until the next reset. + + .. attribute:: Mastodon.ratelimit_reset + + Time at which the rate limit will next be reset, as a POSIX timestamp. + + .. attribute:: Mastodon.ratelimit_limit + + Total number of requests allowed between resets. Typically 300. + + .. attribute:: Mastodon.ratelimit_lastcall + + Time at which these values have last been seen and updated, as a POSIX timestamp. + In "wait" mode, once a request hits the rate limit, Mastodon.py will wait until the rate limit resets and then try again, until the request succeeds or an error 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 to respect these. If your application requires many hits to endpoints that are available without logging -in, do consider using Mastodon.py without authenticating to get the full per-IP limit. In -this case, you can set the Mastodon objects `ratelimit_limit` and `ratelimit_remaining` -properties appropriately if you want to use advanced rate limit handling. +in, do consider using Mastodon.py without authenticating to get the full per-IP limit. + A note about pagination ----------------------- -- cgit v1.2.3