Skip to content

Commit 44dfcc9

Browse files
authored
Allow to disable SSL certificate verification in CLI (#21)
* Allow to disable SSL certificate verification in package upload * Add global option * Implement JJ's comments * Fix pre-commit
1 parent 00a0a7c commit 44dfcc9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/quetz_client/cli.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import os
2+
from typing import Optional
23

34
import fire
45

56
from quetz_client.client import QuetzClient
67

78

8-
def get_client(*, url=None, token=None) -> QuetzClient:
9+
def get_client(
10+
*, url: Optional[str] = None, token: Optional[str] = None, insecure: bool = False
11+
) -> QuetzClient:
912
"""
1013
CLI tool to interact with a Quetz server.
1114
@@ -18,10 +21,14 @@ def get_client(*, url=None, token=None) -> QuetzClient:
1821
token: Optional[str]
1922
The API key needed to authenticate with the server.
2023
Defaults to the `QUETZ_API_KEY` environment variable.
24+
25+
insecure: bool
26+
Allow quetz-client to perform "insecure" SSL connections.
2127
"""
22-
url = url or os.environ.get("QUETZ_SERVER_URL")
23-
token = token or os.environ.get("QUETZ_API_KEY")
28+
url = url or os.environ["QUETZ_SERVER_URL"]
29+
token = token or os.environ["QUETZ_API_KEY"]
2430
client = QuetzClient.from_token(url, token)
31+
client.session.verify = not insecure
2532
return client
2633

2734

0 commit comments

Comments
 (0)