Skip to content

Commit

Permalink
Agregando log.critical(error)
Browse files Browse the repository at this point in the history
  • Loading branch information
germankay committed Dec 4, 2024
1 parent cf28e57 commit 7b46949
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ckanext/superset/data/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ def prepare_connection(self):
login_url = f"{self.superset_url}/api/v1/security/login"
login_response = self.client.post(login_url, json=self.login_payload)
data = login_response.json()
if "access_token" not in data:
error = f"Error getting access token from Superset: {data}"
log.critical(error)
raise SupersetRequestException(error)

self.access_token = data["access_token"]

# Get a session for the user (works for CSV)
Expand All @@ -170,6 +175,8 @@ def prepare_connection(self):
login_response = self.client.post(login_url, data=data)
# Get expect a 302 redirect to /
if login_response.status_code != 302:
error = f"Unexpected status code: {login_response.status_code} from Superset login"
log.critical(error)
login_response.raise_for_status()
# Save cookies from the login response
self.client.cookies.update(login_response.cookies)
Expand Down

0 comments on commit 7b46949

Please sign in to comment.