Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to not verify the ssl certificate #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions art/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from . import _yaml


def save(gitlab_url, private_token):
def save(gitlab_url, private_token, verify_ssl):
config = {
'gitlab_url': gitlab_url,
'auth_header': {'PRIVATE-TOKEN': private_token}
'auth_header': {'PRIVATE-TOKEN': private_token},
'verify_ssl': verify_ssl
}
_paths.mkdirs(os.path.dirname(_paths.config_file))
_yaml.save(_paths.config_file, config)
Expand Down
5 changes: 3 additions & 2 deletions art/_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ def quote(url):

class Gitlab(object):

def __init__(self, gitlab_url, auth_header):
def __init__(self, gitlab_url, auth_header, verify_ssl):
self.api_url = gitlab_url + '/api/v3'
self.headers = auth_header
self.verify = False if verify_ssl == 'False' else True

def _get(self, request, *args, **kwargs):
r = requests.get(self.api_url + request % args, headers=self.headers, **kwargs)
r = requests.get(self.api_url + request % args, headers=self.headers, verify=self.verify, **kwargs)
r.raise_for_status()
return r

Expand Down
1 change: 1 addition & 0 deletions art/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def main(cache):
@main.command()
@click.argument('gitlab_url')
@click.argument('private_token')
@click.argument('verify_ssl')
def configure(**kwargs):
"""Configure Gitlab URL and access token."""

Expand Down