Changed compatibility
This commit is contained in:
+8
-8
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user