Skip to content

Commit

Permalink
Removed magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
gabryelreyes committed Jun 21, 2024
1 parent 97e0c35 commit 2a6a317
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pySupersetCli/superset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2a6a317

Please sign in to comment.