summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-01-01 17:28:08 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2018-01-01 17:34:55 +0100
commit6f50447917f3af4ab6611d0fdf7eb9bb67ee32c5 (patch)
treecf7f9744b77de01aba573302645d108a0b9fe2e5
parent2e2a78da9e3910bceb30bd9ac9e574b8b1425d05 (diff)
downloadgitlab-6f50447917f3af4ab6611d0fdf7eb9bb67ee32c5.tar.gz
Respect content of REQUESTS_CA_BUNDLE and *_proxy envvars
Explicitly call the requests session.merge_environment_settings() method, which will use some environment variables to setup the session properly. Closes #352
-rw-r--r--RELEASE_NOTES.rst2
-rw-r--r--gitlab/__init__.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index a9008f7..707b90d 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -7,6 +7,8 @@ This page describes important changes between python-gitlab releases.
Changes from 1.1 to 1.2
=======================
+* python-gitlab now respects the ``*_proxy``, ``REQUESTS_CA_BUNDLE`` and
+ ``CURL_CA_BUNDLE`` environment variables (#352)
* The following deprecated methods and objects have been removed:
* gitlab.v3.object ``Key`` and ``KeyManager`` objects: use ``DeployKey`` and
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 738085a..89a787a 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -677,8 +677,9 @@ class Gitlab(object):
files=files, **opts)
prepped = self.session.prepare_request(req)
prepped.url = sanitized_url(prepped.url)
- result = self.session.send(prepped, stream=streamed, verify=verify,
- timeout=timeout)
+ settings = self.session.merge_environment_settings(
+ prepped.url, {}, streamed, verify, None)
+ result = self.session.send(prepped, timeout=timeout, **settings)
if 200 <= result.status_code < 300:
return result