Skip to content

Commit ad4de20

Browse files
committed
docs(api-usage): add rate limit documentation
1 parent 2abf9ab commit ad4de20

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/api-usage.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,26 @@ The following sample illustrates how to use a client-side certificate:
326326
327327
Reference:
328328
http://docs.python-requests.org/en/master/user/advanced/#client-side-certificates
329+
330+
Rate limits
331+
-----------
332+
333+
python-gitlab will obey the rate limit of the GitLab server by default.
334+
On receiving a 429 response (Too Many Requests), python-gitlab will sleep for the amount of time
335+
in the Retry-After header, that GitLab sends back.
336+
337+
If you don't want to wait, you can disable the rate-limiting feature, by supplying the
338+
``obey_rate_limit`` argument.
339+
340+
.. code-block:: python
341+
342+
import gitlab
343+
import requests
344+
345+
gl = gitlab.gitlab(url, token, api_version=4)
346+
gl.projects.list(all=True, obey_rate_limit=False)
347+
348+
349+
.. warning::
350+
351+
You will get an Exception, if you then go over the rate limit of your GitLab instance.

0 commit comments

Comments
 (0)