Skip to content

Commit 429855c

Browse files
bunnisiMicknl
andauthored
Add possibility in example to ignore cert errors and fix the verify_ssl assignment in code (#353)
This addresses #298, adding it explicitly to the example and making it easier for new users to toggle it. Additionally, the TCPConnector assignment was broken, and this was fixed too. --------- Co-authored-by: Mick <mick@imick.nl>
1 parent c62f9a3 commit 429855c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ HOST = ""
6565
USERNAME = ""
6666
PASSWORD = ""
6767
ENCRYPTION_METHOD = EncryptionMethod.SHA512 # or EncryptionMethod.MD5
68+
VALIDATE_SSL_CERT = True
6869

6970
async def main() -> None:
70-
async with SagemcomClient(HOST, USERNAME, PASSWORD, ENCRYPTION_METHOD) as client:
71+
async with SagemcomClient(HOST, USERNAME, PASSWORD, ENCRYPTION_METHOD, verify_ssl=VALIDATE_SSL_CERT) as client:
7172
try:
7273
await client.login()
7374
except Exception as exception: # pylint: disable=broad-except

sagemcom_api/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ def __init__(
106106
else ClientSession(
107107
headers={"User-Agent": f"{DEFAULT_USER_AGENT}"},
108108
timeout=ClientTimeout(DEFAULT_TIMEOUT),
109-
connector=TCPConnector(verify_ssl=verify_ssl if verify_ssl else True),
109+
connector=TCPConnector(
110+
verify_ssl=verify_ssl if verify_ssl is not None else True
111+
),
110112
)
111113
)
112114

0 commit comments

Comments
 (0)