Skip to content

Commit

Permalink
Update verify_ssl behaviour in Configuration class (#726)
Browse files Browse the repository at this point in the history
* Expose verify_ssl attribute in Configuration init and set it to false for insecure connections

Signed-off-by: lugi0 <[email protected]>

* Apply suggested patch

Signed-off-by: lugi0 <[email protected]>

---------

Signed-off-by: lugi0 <[email protected]>
  • Loading branch information
lugi0 authored Jan 29, 2025
1 parent 822028f commit 77657a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/python/src/model_registry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def insecure_connection(
user_token: The PEM-encoded user token as a string.
"""
return cls(
Configuration(host=f"{server_address}:{port}", access_token=user_token)
Configuration(host=f"{server_address}:{port}", access_token=user_token, verify_ssl=False)
)

@asynccontextmanager
Expand Down
8 changes: 6 additions & 2 deletions clients/python/src/mr_openapi/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ class Configuration:
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
:param ssl_ca_cert: str - The path to a file of concatenated CA certificates
in PEM format.
:param verify_ssl: bool - Whether to verify the SSL certificate when making API
requests to an HTTPS server.
Set to False to disable verification, default=True.
:Example:
"""
Expand All @@ -74,6 +77,7 @@ def __init__(
server_operation_index=None,
server_operation_variables=None,
ssl_ca_cert=None,
verify_ssl=True,
) -> None:
"""Constructor."""
self._base_path = "https://localhost:8080" if host is None else host
Expand Down Expand Up @@ -133,7 +137,7 @@ def __init__(
"""Debug switch
"""

self.verify_ssl = True
self.verify_ssl = verify_ssl
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down

0 comments on commit 77657a1

Please sign in to comment.