← 返回首页
fix(cli): add ability to disable SSL verification · python-gitlab/python-gitlab@3fe9fa6 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit 3fe9fa6

Browse files
authored andcommitted
fix(cli): add ability to disable SSL verification
Add a `--no-ssl-verify` option to disable SSL verification Closes: #2714
1 parent fad1441 commit 3fe9fa6

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎gitlab/cli.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,25 @@ def _get_base_parser(add_help: bool = True) -> argparse.ArgumentParser:
194194
required=False,
195195
default=os.getenv("GITLAB_URL"),
196196
)
197-
parser.add_argument(
197+
198+
ssl_verify_group = parser.add_mutually_exclusive_group()
199+
ssl_verify_group.add_argument(
198200
"--ssl-verify",
199201
help=(
200-
"Whether SSL certificates should be validated. [env var: GITLAB_SSL_VERIFY]"
202+
"Path to a CA_BUNDLE file or directory with certificates of trusted CAs. "
203+
"[env var: GITLAB_SSL_VERIFY]"
201204
),
202205
required=False,
203206
default=os.getenv("GITLAB_SSL_VERIFY"),
204207
)
208+
ssl_verify_group.add_argument(
209+
"--no-ssl-verify",
210+
help="Disable SSL verification",
211+
required=False,
212+
dest="ssl_verify",
213+
action="store_false",
214+
)
215+
205216
parser.add_argument(
206217
"--timeout",
207218
help=(

‎tests/unit/test_cli.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ def test_base_parser():
106106
assert args.verbose
107107
assert args.gitlab == "gl_id"
108108
assert args.config_file == ["foo.cfg", "bar.cfg"]
109+
assert args.ssl_verify is None
110+
111+
112+
def test_no_ssl_verify():
113+
parser = cli._get_base_parser()
114+
args = parser.parse_args(["--no-ssl-verify"])
115+
assert args.ssl_verify is False
109116

110117

111118
def test_v4_parse_args():

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.