aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-27 17:21:46 +0200
committerGitHub <[email protected]>2019-04-27 17:21:46 +0200
commit28ba394cb9f24cc550b33f41b32ebee727b10223 (patch)
tree64faf4c30ab976d3dd96516565280fd3153bbd5e /docs
parenta264154073dc59b89cd37887de33da45f96ca026 (diff)
parent1041db3b95db8d9484eefcdb1ab205cfe8aa5a43 (diff)
downloadmastodon.py-28ba394cb9f24cc550b33f41b32ebee727b10223.tar.gz
Merge pull request #161 from codl/doc-ratelimit
document rate limiting attributes
Diffstat (limited to 'docs')
-rw-r--r--docs/index.rst25
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
71or applications wanting to use Mastodon.py in a multi-threaded context ("wait" and "pace" 71or applications wanting to use Mastodon.py in a multi-threaded context ("wait" and "pace"
72modes are not thread safe). 72modes 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
74In "wait" mode, once a request hits the rate limit, Mastodon.py will wait until 94In "wait" mode, once a request hits the rate limit, Mastodon.py will wait until
75the rate limit resets and then try again, until the request succeeds or an error 95the rate limit resets and then try again, until the request succeeds or an error
76is encountered. This mode is for applications that would rather just not worry about rate limits 96is 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
91to respect these. 111to respect these.
92 112
93If your application requires many hits to endpoints that are available without logging 113If your application requires many hits to endpoints that are available without logging
94in, do consider using Mastodon.py without authenticating to get the full per-IP limit. In 114in, do consider using Mastodon.py without authenticating to get the full per-IP limit.
95this case, you can set the Mastodon objects `ratelimit_limit` and `ratelimit_remaining` 115
96properties appropriately if you want to use advanced rate limit handling.
97 116
98A note about pagination 117A note about pagination
99----------------------- 118-----------------------
Powered by cgit v1.2.3 (git 2.41.0)