Fix black errors shown with the latest version of black
[osm/osmclient.git] / osmclient / sol005 / client.py
index c7f043b..4f15fc5 100644 (file)
@@ -40,6 +40,7 @@ from osmclient.sol005 import repo
 from osmclient.sol005 import osmrepo
 from osmclient.sol005 import subscription
 from osmclient.common import package_tool
+from osmclient.common.exceptions import ClientException
 import json
 import logging
 
@@ -54,7 +55,6 @@ class Client(object):
         project="admin",
         **kwargs
     ):
-
         self._user = user
         self._password = password
         self._project = project
@@ -107,7 +107,7 @@ class Client(object):
         self.utils = utils.Utils(http_client, **kwargs)
         """
 
-    def get_token(self):
+    def get_token(self, pwd_change=None):
         self._logger.debug("")
         if self._token is None:
             postfields_dict = {
@@ -129,6 +129,10 @@ class Client(object):
             #                raise ClientException(message)
 
             token = json.loads(resp) if resp else None
+            if token.get("message") == "change_password" and not pwd_change:
+                raise ClientException(
+                    "Password Expired. Please update the password using change_password option"
+                )
             self._token = token["id"]
 
             if self._token is not None: