From cb8073ef336ef22208128b331f593c7457f3537e Mon Sep 17 00:00:00 2001 From: Tomasz Warda <85410520+tomaszwarda@users.noreply.github.com> Date: Fri, 3 Mar 2023 14:12:08 +0100 Subject: [PATCH] Custom logger as option in create_vManageSession (#136) * optional logger and bump * fix --- pyproject.toml | 2 +- vmngclient/session.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b90d0873c..06d513a4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "vmngclient" -version = "0.6.0" +version = "0.6.1" description = "Universal vManage API" authors = ["kagorski "] readme = "README.md" diff --git a/vmngclient/session.py b/vmngclient/session.py index 51255c174..e158e186b 100644 --- a/vmngclient/session.py +++ b/vmngclient/session.py @@ -51,6 +51,7 @@ def create_vManageSession( password: str, port: Optional[int] = None, subdomain: Optional[str] = None, + logger: Optional[logging.Logger] = None ) -> vManageSession: """Factory function that creates session object based on provided arguments. @@ -61,12 +62,15 @@ def create_vManageSession( password (str): password subdomain: subdomain specifying to which view switch when creating provider as a tenant session, works only on provider user mode + logger: logger for logging API requests Returns: Session object """ session = vManageSession(url=url, username=username, password=password, port=port, subdomain=subdomain) + if logger: + session.logger = logger session.auth = vManageAuth(session.base_url, username, password, verify=False) if subdomain: