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. Use the libmeshctrl library to initiate a Secure Websocket (wss) connection to the MeshCentral instance.
''' '''
if configuration["totp_secret"]: if "totp_secret" in credentials:
totp = pyotp.TOTP(configuration["totp_secret"]) totp = pyotp.TOTP(credentials["totp_secret"])
otp = totp.now() otp = totp.now()
session = meshctrl.Session( session = meshctrl.Session(
configuration['hostname'], credentials['hostname'],
user=configuration['username'], user=credentials['username'],
password=configuration['password'], password=credentials['password'],
token=otp token=otp
) )
else: else:
session = meshctrl.Session( session = meshctrl.Session(
configuration['hostname'], credentials['hostname'],
user=configuration['username'], user=credentials['username'],
password=configuration['password'] password=credentials['password']
) )
await session.initialized.wait() await session.initialized.wait()
return session return session