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 cd098d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 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 All @@ -104,6 +104,7 @@ def __init__(
client_name: For internal use only.
Define the name of the graphQL client whith which graphQL calls will be sent.
graphql_client_params: Parameters to pass to the graphQL client.
verbose: If True, store information about complexity ?
Returns:
Instance of the Kili client.
Expand Down Expand Up @@ -134,13 +135,18 @@ 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 cd098d9

Please sign in to comment.