Skip to content

Commit

Permalink
[FEATURE] Optional auth for AutosysSensor (#87)
Browse files Browse the repository at this point in the history
* optional auth for AutosysSensor

* update CONTRIBUTORS.md

* dropping the auth

---------

Co-authored-by: M <[email protected]>
Co-authored-by: Maxim Mityutko <[email protected]>
  • Loading branch information
3 people authored Feb 16, 2024
1 parent 399bbea commit 336d1c9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions brickflow_plugins/airflow/operators/external_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ def __init__(
url: str,
job_name: str,
poke_interval: int,
airflow_cluster_auth: AirflowClusterAuth,
time_delta: Union[timedelta, dict] = {"days": 0},
*args,
**kwargs,
Expand All @@ -355,7 +354,6 @@ def __init__(
self.url = url
self.job_name = job_name
self.poke_interval = poke_interval
self.airflow_auth = airflow_cluster_auth
self.time_delta = time_delta
self.url = self.url + self.job_name

Expand All @@ -369,15 +367,17 @@ def __init__(

def poke(self, context):
logging.info("Poking: " + self.url)
token = self.airflow_auth.get_access_token()

headers = {
"Accept": "application/json",
"cache-control": "no-cache",
}

response = requests.get(
self.url,
headers={
"Authorization": f"Bearer {token}",
"Accept": "application/json",
"cache-control": "no-cache",
},
verify=False,
headers=headers,
verify=False, # nosec
timeout=10,
)

if response.status_code != 200:
Expand Down

0 comments on commit 336d1c9

Please sign in to comment.