Skip to content

Commit

Permalink
fix when websession and api_proxy_cert are provided
Browse files Browse the repository at this point in the history
Fix for when both websession and api_proxy_cert are provided.
  • Loading branch information
ehendrix23 authored Nov 25, 2024
1 parent 3ba92f1 commit 6653d50
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ def __init__(
ssl_context = ssl.create_default_context()
websession = httpx.AsyncClient(timeout=60, verify=ssl_context)

if api_proxy_cert:
# Loading custom SSL certificate for proxy does blocking I/O.
# It is recommended to instead pass an httpx.AsyncClient that
# already has an SSL context with the custom certificate loaded.
try:
ssl_context.load_verify_locations(api_proxy_cert)
except (FileNotFoundError, ssl.SSLError):
_LOGGER.warning("Unable to load custom SSL certificate from %s", api_proxy_cert)
if api_proxy_cert:
# Loading custom SSL certificate for proxy does blocking I/O.
# It is recommended to instead pass an httpx.AsyncClient that
# already has an SSL context with the custom certificate loaded.
try:
ssl_context.load_verify_locations(api_proxy_cert)
except (FileNotFoundError, ssl.SSLError):
_LOGGER.warning("Unable to load custom SSL certificate from %s", api_proxy_cert)

self.__connection = Connection(
websession=websession,
Expand Down

0 comments on commit 6653d50

Please # to comment.