diff options
author | Max Wittig <max.wittig@siemens.com> | 2019-01-13 12:01:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-13 12:01:07 +0100 |
commit | 89679ce5ee502e57dbe7cec2b78f4f70b85fd3a5 (patch) | |
tree | bb14b5569d330e84b6b21cf3fdca9cc2fe7a2e36 /docs/api-usage.rst | |
parent | ce2c8356cdd0e086ec67a1bf73adc2d0ea251971 (diff) | |
parent | 16bda20514e036e51bef210b565671174cdeb637 (diff) | |
download | gitlab-89679ce5ee502e57dbe7cec2b78f4f70b85fd3a5.tar.gz |
Merge pull request #678 from appian/backoff-requests
Fix missing "Retry-After" header and fix integration tests
Diffstat (limited to 'docs/api-usage.rst')
-rw-r--r-- | docs/api-usage.rst | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst index 73d1377..a5afbda 100644 --- a/docs/api-usage.rst +++ b/docs/api-usage.rst @@ -299,7 +299,9 @@ Rate limits python-gitlab obeys the rate limit of the GitLab server by default. On receiving a 429 response (Too Many Requests), python-gitlab sleeps for the -amount of time in the Retry-After header that GitLab sends back. +amount of time in the Retry-After header that GitLab sends back. If GitLab +does not return a response with the Retry-After header, python-gitlab will +perform an exponential backoff. If you don't want to wait, you can disable the rate-limiting feature, by supplying the ``obey_rate_limit`` argument. @@ -312,6 +314,18 @@ supplying the ``obey_rate_limit`` argument. gl = gitlab.gitlab(url, token, api_version=4) gl.projects.list(all=True, obey_rate_limit=False) +If you do not disable the rate-limiting feature, you can supply a custom value +for ``max_retries``; by default, this is set to 10. To retry without bound when +throttled, you can set this parameter to -1. This parameter is ignored if +``obey_rate_limit`` is set to ``False``. + +.. code-block:: python + + import gitlab + import requests + + gl = gitlab.gitlab(url, token, api_version=4) + gl.projects.list(all=True, max_retries=12) .. warning:: |