Skip to content

Commit 6430c11

Browse files
GuyKhfabaff
andauthored
Support disabling SSL verification (#4)
* Support disabling SSL verification * Update glances_api/__init__.py Co-authored-by: Fabian Affolter <[email protected]> * Move verify to client instance Co-authored-by: Fabian Affolter <[email protected]>
1 parent e3c7e28 commit 6430c11

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

glances_api/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(
1919
port=61208,
2020
version=2,
2121
ssl=False,
22+
verify_ssl=True,
2223
username=None,
2324
password=None,
2425
):
@@ -31,13 +32,14 @@ def __init__(
3132
self.values = None
3233
self.username = username
3334
self.password = password
35+
self.verify_ssl = verify_ssl
3436

3537
async def get_data(self, endpoint):
3638
"""Retrieve the data."""
3739
url = "{}/{}".format(self.url, endpoint)
3840

3941
try:
40-
async with httpx.AsyncClient() as client:
42+
async with httpx.AsyncClient(verify=self.verify_ssl) as client:
4143
if self.password is None:
4244
response = await client.get(str(url))
4345
else:

0 commit comments

Comments
 (0)