Skip to content

Commit

Permalink
add verify_ssl option to gitlab service
Browse files Browse the repository at this point in the history
  • Loading branch information
muxync committed Nov 13, 2015
1 parent 805e3e7 commit a67e7ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions bugwarrior/docs/services/gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ If your Gitlab instance is only available over HTTP, set::

gitlab.use_https = False

Do Not Verify SSL Certificate
+++++++++++++++++++++++++++++

If want to ignore verifying the SSL certificate, set::

gitlab.verify_ssl = False


Provided UDA Fields
-------------------
Expand Down
8 changes: 7 additions & 1 deletion bugwarrior/services/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def __init__(self, *args, **kw):
else:
self.scheme = 'http'

self.verify_ssl = self.config_get_default(
'verify_ssl', default=True, to_type=asbool
)

self.exclude_repos = []
if self.config_get_default('exclude_repos', None):
self.exclude_repos = [
Expand Down Expand Up @@ -274,7 +278,9 @@ def _fetch(self, tmpl, **kwargs):
url = tmpl.format(scheme=self.scheme, host=self.auth[0])
headers = {'PRIVATE-TOKEN': self.auth[1]}

response = requests.get(url, headers=headers, **kwargs)
if not self.verify_ssl:
requests.packages.urllib3.disable_warnings()
response = requests.get(url, headers=headers, verify=self.verify_ssl, **kwargs)

if callable(response.json):
json_res = response.json()
Expand Down

0 comments on commit a67e7ee

Please sign in to comment.