You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/07/15 18:17:56 UTC
[airflow] branch main updated: Set grant type of the Tabular hook (#25099)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 84b679937f Set grant type of the Tabular hook (#25099)
84b679937f is described below
commit 84b679937f220fd06b4f639320d8d992120875e5
Author: Fokko Driesprong <fo...@apache.org>
AuthorDate: Fri Jul 15 20:17:49 2022 +0200
Set grant type of the Tabular hook (#25099)
---
airflow/providers/tabular/hooks/tabular.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/airflow/providers/tabular/hooks/tabular.py b/airflow/providers/tabular/hooks/tabular.py
index 11dbb877d6..fcf7d85d42 100644
--- a/airflow/providers/tabular/hooks/tabular.py
+++ b/airflow/providers/tabular/hooks/tabular.py
@@ -68,7 +68,7 @@ class TabularHook(BaseHook):
self.get_conn()
return True, "Successfully fetched token from Tabular"
except HTTPError as e:
- return False, f"HTTP Error: {e}"
+ return False, f"HTTP Error: {e}: {e.response.text}"
except Exception as e:
return False, str(e)
@@ -79,10 +79,9 @@ class TabularHook(BaseHook):
base_url = base_url.rstrip('/')
client_id = conn.login
client_secret = conn.password
- headers = {"Content-Type": "application/x-www-form-urlencoded"}
- data = {"client_id": client_id, "client_secret": client_secret}
+ data = {"client_id": client_id, "client_secret": client_secret, "grant_type": "client_credentials"}
- response = requests.post(f"{base_url}/{TOKENS_ENDPOINT}", data=data, headers=headers)
+ response = requests.post(f"{base_url}/{TOKENS_ENDPOINT}", data=data)
response.raise_for_status()
return response.json()["access_token"]