From 622fbc63bc661506b318e2f2b4fdf0b0d1e5feda Mon Sep 17 00:00:00 2001 From: Alex Erohin Date: Wed, 6 Nov 2024 15:24:08 +0300 Subject: [PATCH] fixed TplinkRouterProvider --- setup.py | 2 +- tplinkrouterc6u/client.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 587f6fc..4a14208 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="tplinkrouterc6u", - version="5.0.1", + version="5.0.2", author="Alex Erohin", author_email="alexanderErohin@yandex.ru", description="TP-Link Router API", diff --git a/tplinkrouterc6u/client.py b/tplinkrouterc6u/client.py index 2c7bda6..fa72967 100644 --- a/tplinkrouterc6u/client.py +++ b/tplinkrouterc6u/client.py @@ -1440,8 +1440,10 @@ def get_client(host: str, password: str, username: str = 'admin', logger: Logger router = TplinkC1200Router(host, password, username, logger, verify_ssl, timeout) try: router.authorize() + return router except AuthorizeError as e: - logger.error(e.__str__()) + if logger: + logger.error(e.__str__()) raise ClientException(('Login failed! Please check if your router local password is correct or ' 'try to use web encrypted password instead. Check the documentation!' ))