summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAndrew Tergis <andrew.tergis@littlebits.com>2019-12-10 12:23:10 -0500
committerAndrew Tergis <andrew.tergis@littlebits.com>2019-12-16 13:45:38 -0500
commite9a8289a381ebde7c57aa2364258d84b4771d276 (patch)
tree2b8832fe06dfa0fb7e9fe700449644a8d8beaf16 /docs
parentaa4d41b70b2a66c3de5a7dd19b0f7c151f906630 (diff)
downloadgitlab-e9a8289a381ebde7c57aa2364258d84b4771d276.tar.gz
feat: allow cfg timeout to be overrided via kwargs
On startup, the `timeout` parameter is loaded from config and stored on the base gitlab object instance. This instance parameter is used as the timeout for all API requests (it's passed into the `session` object when making HTTP calls). This change allows any API method to specify a `timeout` argument to `**kwargs` that will override the global timeout value. This was somewhat needed / helpful for the `import_github` method. I have also updated the docs accordingly.
Diffstat (limited to 'docs')
-rw-r--r--docs/api-usage.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/api-usage.rst b/docs/api-usage.rst
index fc2314e..d211e25 100644
--- a/docs/api-usage.rst
+++ b/docs/api-usage.rst
@@ -366,3 +366,20 @@ default an exception is raised for these errors.
gl = gitlab.gitlab(url, token, api_version=4)
gl.projects.list(all=True, retry_transient_errors=True)
+
+Timeout
+-------
+
+python-gitlab will by default use the ``timeout`` option from it's configuration
+for all requests. This is passed downwards to the ``requests`` module at the
+time of making the HTTP request. However if you would like to override the
+global timeout parameter for a particular call, you can provide the ``timeout``
+parameter to that API invocation:
+
+.. code-block:: python
+
+ import gitlab
+
+ gl = gitlab.gitlab(url, token, api_version=4)
+ gl.projects.import_github(ACCESS_TOKEN, 123456, "root", timeout=120.0)
+