Skip to content

Commit 33afeeb

Browse files
CopilotiMicknl
andcommitted
Revert SSL context creation to avoid blocking I/O at runtime and add TODO comment
Co-authored-by: iMicknl <1424596+iMicknl@users.noreply.github.com>
1 parent 4b5ab57 commit 33afeeb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pyoverkiz/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ def __init__(
166166
if self.server_config.type == APIType.LOCAL and verify_ssl:
167167
# To avoid security issues while authentication to local API, we add the following authority to
168168
# our HTTPS client trust store: https://ca.overkiz.com/overkiz-root-ca-2048.crt
169-
# Create a new SSL context to avoid mutating the shared global context
170-
self._ssl = _create_local_ssl_context()
169+
# Create a copy of the SSL context to avoid mutating the shared global context
170+
self._ssl = ssl.SSLContext(SSL_CONTEXT_LOCAL_API.protocol)
171+
self._ssl.load_verify_locations(
172+
cafile=os.path.dirname(os.path.realpath(__file__))
173+
+ "/overkiz-root-ca-2048.crt"
174+
)
171175

172176
# Disable strict validation introduced in Python 3.13, which doesn't
173177
# work with Overkiz self-signed gateway certificates

pyoverkiz/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create_server_config(
3737
configuration_url: str | None = None,
3838
) -> ServerConfig:
3939
"""Generate server configuration with the provided endpoint and metadata."""
40-
# ServerConfig.__init__ handles the enum conversion, but mypy doesn't recognize
40+
# TODO fix: ServerConfig.__init__ handles the enum conversion, but mypy doesn't recognize
4141
# this due to attrs @define decorator generating __init__ with stricter signatures,
4242
# so we need type: ignore comments.
4343
return ServerConfig(

0 commit comments

Comments
 (0)