Skip to content

Commit

Permalink
chore: add a way to disable or enable verify based on env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-olivier committed Oct 22, 2024
1 parent 1e84723 commit 33b921c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/kili/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(
self,
api_key: Optional[str] = None,
api_endpoint: Optional[str] = None,
verify: Union[bool, str] = True,
verify: Optional[Union[bool, str]] = None,
client_name: GraphQLClientName = GraphQLClientName.SDK,
graphql_client_params: Optional[Dict[str, object]] = None,
) -> None:
Expand Down Expand Up @@ -135,12 +135,17 @@ def __init__(
if not api_key:
raise AuthenticationFailed(api_key, api_endpoint)

if verify is None:
verify = os.getenv(
"KILI_VERIFY",
"True",
).lower() in ("true", "1", "yes")

self.api_key = api_key
self.api_endpoint = api_endpoint
self.verify = verify
self.client_name = client_name
self.http_client = HttpClient(kili_endpoint=api_endpoint, verify=verify, api_key=api_key)

skip_checks = os.getenv("KILI_SDK_SKIP_CHECKS") is not None
if not skip_checks and not is_api_key_valid(
self.http_client, api_key, api_endpoint, client_name
Expand Down

0 comments on commit 33b921c

Please sign in to comment.