Changed compatibility

This commit is contained in:
2025-07-21 22:42:16 +02:00
parent 07d0b99c47
commit 615a438003
+8 -8
View File
@@ -21,21 +21,21 @@ async def init_connection(credentials: dict) -> meshctrl.Session:
Use the libmeshctrl library to initiate a Secure Websocket (wss) connection to the MeshCentral instance.
'''
if configuration["totp_secret"]:
totp = pyotp.TOTP(configuration["totp_secret"])
if "totp_secret" in credentials:
totp = pyotp.TOTP(credentials["totp_secret"])
otp = totp.now()
session = meshctrl.Session(
configuration['hostname'],
user=configuration['username'],
password=configuration['password'],
credentials['hostname'],
user=credentials['username'],
password=credentials['password'],
token=otp
)
else:
session = meshctrl.Session(
configuration['hostname'],
user=configuration['username'],
password=configuration['password']
credentials['hostname'],
user=credentials['username'],
password=credentials['password']
)
await session.initialized.wait()
return session