shahar1 commented on code in PR #44302:
URL: https://github.com/apache/airflow/pull/44302#discussion_r1855179671


##########
providers/src/airflow/providers/http/hooks/http.py:
##########
@@ -72,6 +74,7 @@ def __init__(
         method: str = "POST",
         http_conn_id: str = default_conn_name,
         auth_type: Any = None,
+        adapter: BaseAdapter | None = None,

Review Comment:
   Please add an appropriate docstring in the section above



##########
providers/src/airflow/providers/http/hooks/http.py:
##########
@@ -143,6 +151,18 @@ def get_conn(self, headers: dict[Any, Any] | None = None) 
-> requests.Session:
         if headers:
             session.headers.update(headers)
 
+        if self.adapter:
+            scheme = urlparse(self.base_url).scheme if self.base_url else 
"https"
+            session.mount(f"{scheme}://", self.adapter)
+        elif self.tcp_keep_alive:
+            keep_alive_adapter = TCPKeepAliveAdapter(
+                idle=self.keep_alive_idle,
+                count=self.keep_alive_count,
+                interval=self.keep_alive_interval,
+            )
+            session.mount("http://";, keep_alive_adapter)
+            session.mount("https://";, keep_alive_adapter)

Review Comment:
   We do we need to instantiate `TCPKeepAliveAdapter` here if we already have 
it in the `run` method?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to