kaxil commented on code in PR #42840:
URL: https://github.com/apache/airflow/pull/42840#discussion_r1792509374


##########
airflow/providers/dbt/cloud/hooks/dbt.py:
##########
@@ -244,26 +244,21 @@ async def get_job_details(
         endpoint = f"{account_id}/runs/{run_id}/"
         headers, tenant = await self.get_headers_tenants_from_connection()
         url, params = self.get_request_url_params(tenant, endpoint, 
include_related)
-        proxies = self._get_proxies(self.connection)
+        proxies = self._get_proxies(self.connection) or {}
+
         async with aiohttp.ClientSession(headers=headers) as session:
-            if proxies is not None:
-                if url.startswith("https"):
-                    proxy = proxies.get("https")
-                else:
-                    proxy = proxies.get("http")
-                async with session.get(url, params=params, proxy=proxy) as 
response:
-                    try:
-                        response.raise_for_status()
-                        return await response.json()
-                    except aiohttp.ClientResponseError as e:
-                        raise AirflowException(f"{e.status}:{e.message}")
-            else:
-                async with session.get(url, params=params) as response:
-                    try:
-                        response.raise_for_status()
-                        return await response.json()
-                    except aiohttp.ClientResponseError as e:
-                        raise AirflowException(f"{e.status}:{e.message}")
+            proxy = proxies.get("https") if proxies and 
url.startswith("https") else proxies.get("http")
+            extra_request_args = {}
+
+            if proxy:
+                extra_request_args["proxy"] = proxy
+
+            try:
+                async with session.get(url, params=params, 
**extra_request_args) as response:    # type: ignore[arg-type]
+                    response.raise_for_status()
+                    return await response.json()
+            except aiohttp.ClientResponseError as e:
+                raise AirflowException(f"{e.status}: {e.message}")

Review Comment:
   True



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to