diff --git a/asyncua/client/client.py b/asyncua/client/client.py index 758b0a10d..755b94329 100644 --- a/asyncua/client/client.py +++ b/asyncua/client/client.py @@ -143,12 +143,12 @@ def set_user(self, username: str) -> None: """ self._username = username - def set_password(self, pwd: str) -> None: + def set_password(self, pwd: str | None) -> None: """ Set user password for the connection. initial password from the URL will be overwritten """ - if not isinstance(pwd, str): + if pwd is not None and not isinstance(pwd, str): raise TypeError(f"Password must be a string, got {pwd} of type {type(pwd)}") self._password = pwd