Skip to content

Commit

Permalink
Allow to disable SSL certificate verification in CLI (#21)
Browse files Browse the repository at this point in the history
* Allow to disable SSL certificate verification in package upload

* Add global option

* Implement JJ's comments

* Fix pre-commit
  • Loading branch information
borchero authored Apr 6, 2023
1 parent 00a0a7c commit 44dfcc9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/quetz_client/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import os
from typing import Optional

import fire

from quetz_client.client import QuetzClient


def get_client(*, url=None, token=None) -> QuetzClient:
def get_client(
*, url: Optional[str] = None, token: Optional[str] = None, insecure: bool = False
) -> QuetzClient:
"""
CLI tool to interact with a Quetz server.
Expand All @@ -18,10 +21,14 @@ def get_client(*, url=None, token=None) -> QuetzClient:
token: Optional[str]
The API key needed to authenticate with the server.
Defaults to the `QUETZ_API_KEY` environment variable.
insecure: bool
Allow quetz-client to perform "insecure" SSL connections.
"""
url = url or os.environ.get("QUETZ_SERVER_URL")
token = token or os.environ.get("QUETZ_API_KEY")
url = url or os.environ["QUETZ_SERVER_URL"]
token = token or os.environ["QUETZ_API_KEY"]
client = QuetzClient.from_token(url, token)
client.session.verify = not insecure
return client


Expand Down

0 comments on commit 44dfcc9

Please sign in to comment.