Skip to content

Commit 50540d4

Browse files
committed
Add ability to disable SSL/TLS host key check
Host key check is always done by default, but for local deployment without proper CA it is useful to be able to disable host certificate verification.
1 parent 90f2396 commit 50540d4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

iot_inspector_client/client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,25 @@ def __init__(
5050
self,
5151
api_url: str,
5252
ca_bundle: Optional[Path] = None,
53+
disable_tls_verify: Optional[bool] = False,
5354
):
54-
self._client = self._setup_httpx_client(api_url, ca_bundle)
55+
self._client = self._setup_httpx_client(api_url, ca_bundle, disable_tls_verify)
5556

5657
self._id_token_public_key = self._load_key("id-token-public-key")
5758

5859
self._tenant_token_public_key = self._load_key("tenant-token-public-key")
5960

6061
self._state = _LoginState()
6162

62-
def _setup_httpx_client(self, api_url: str, ca_bundle: Optional[Path] = None):
63+
def _setup_httpx_client(
64+
self,
65+
api_url: str,
66+
ca_bundle: Optional[Path] = None,
67+
disable_tls_verify: Optional[bool] = False,
68+
):
69+
if disable_tls_verify:
70+
return httpx.Client(base_url=api_url, verify=False)
71+
6372
if ca_bundle is not None:
6473
ca = ca_bundle.expanduser()
6574
if not ca.exists():

0 commit comments

Comments
 (0)