summaryrefslogtreecommitdiff
path: root/docs/api-usage.rst
diff options
context:
space:
mode:
authorMitar <mitar.git@tnode.com>2019-12-12 20:02:24 -0800
committerMitar <mitar.git@tnode.com>2019-12-12 20:57:37 -0800
commit59fe2714741133989a7beed613f1eeb67c18c54e (patch)
tree088ed4f9e550dc6a18e8ef08f7f003a44ec58005 /docs/api-usage.rst
parent3e2d69417aa8c6b043ee99fea5f8d7e31a2ba3e8 (diff)
downloadgitlab-59fe2714741133989a7beed613f1eeb67c18c54e.tar.gz
feat: retry transient HTTP errors
Fixes #970
Diffstat (limited to 'docs/api-usage.rst')
-rw-r--r--docs/api-usage.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst
index 19b9593..fc2314e 100644
--- a/docs/api-usage.rst
+++ b/docs/api-usage.rst
@@ -348,3 +348,21 @@ throttled, you can set this parameter to -1. This parameter is ignored if
.. warning::
You will get an Exception, if you then go over the rate limit of your GitLab instance.
+
+Transient errors
+----------------
+
+GitLab server can sometimes return a transient HTTP error.
+python-gitlab can automatically retry in such case, when
+``retry_transient_errors`` argument is set to ``True``. When enabled,
+HTTP error codes 500 (Internal Server Error), 502 (502 Bad Gateway),
+503 (Service Unavailable), and 504 (Gateway Timeout) are retried. By
+default an exception is raised for these errors.
+
+.. code-block:: python
+
+ import gitlab
+ import requests
+
+ gl = gitlab.gitlab(url, token, api_version=4)
+ gl.projects.list(all=True, retry_transient_errors=True)