From efadc24d59c2222da0f865781261f388ca5f4df2 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 17 Mar 2020 22:01:15 +0530 Subject: [PATCH] Flag `logged` after actual login With this fix, tokenlogin API will actually mark `_logged` after successful login. Signed-off-by: Abhijeet Kasurde --- fortiosapi/fortiosapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortiosapi/fortiosapi.py b/fortiosapi/fortiosapi.py index 630078e..9e3683b 100644 --- a/fortiosapi/fortiosapi.py +++ b/fortiosapi/fortiosapi.py @@ -193,7 +193,6 @@ def tokenlogin(self, host, apitoken, verify=True, cert=None, timeout=12, vdom="g self._session = requests.session() # may happen at start or if logout is called self._session.headers.update({'Authorization': 'Bearer ' + apitoken}) - self._logged = True LOG.debug("self._https is %s", self._https) if not self._https: self.url_prefix = 'http://' + self.host @@ -211,6 +210,7 @@ def tokenlogin(self, host, apitoken, verify=True, cert=None, timeout=12, vdom="g resp_lic = self.get('system', 'status', vdom=vdom) LOG.debug("response system/status : %s", resp_lic) self._fortiversion = resp_lic['version'] + self._logged = True return True def get_version(self):