diff --git a/src/pySupersetCli/superset.py b/src/pySupersetCli/superset.py index 0c24a95..ad2ba97 100644 --- a/src/pySupersetCli/superset.py +++ b/src/pySupersetCli/superset.py @@ -122,7 +122,7 @@ def _login(self, username: str, password: str, provider: Provider) -> None: login_endpoint, json=login_body) - if ret_code != 200: + if requests.codes.ok != ret_code: LOG.fatal("Login failed: %s", response.get("message")) raise RuntimeError("Login failed") @@ -131,7 +131,7 @@ def _login(self, username: str, password: str, provider: Provider) -> None: # Get the CSRF token ret_code, response = self.request("GET", crsf_token_endpoint) - if ret_code != 200: + if requests.codes.ok != ret_code: LOG.fatal("Get CSRF token failed: %s", response.get("message")) raise RuntimeError("Get CSRF token failed") @@ -191,7 +191,7 @@ def request(self, else: # Check if the token has expired if (reponse_data.get('message') == "Token has expired") and \ - (response_code == 401): + (requests.codes.unauthorized == response_code): LOG.error("Refreshing token is not implemented.") else: response_code = response.status_code