You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/11 19:03:57 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #21527: Update connection object to a `cached_property` in `HttpHook`

mik-laj commented on a change in pull request #21527:
URL: https://github.com/apache/airflow/pull/21527#discussion_r804929393



##########
File path: airflow/providers/http/hooks/http.py
##########
@@ -54,6 +60,10 @@ def __init__(
         self._retry_obj: Callable[..., Any]
         self.auth_type: Any = auth_type
 
+    @cached_property
+    def conn(self):
+        return self.get_connection(self.http_conn_id)

Review comment:
       This is a bit confusing because get_conn returns Request.Session, so this property should return that as well. We have a similar situation with AwsBaseHook.
   https://github.com/apache/airflow/blob/0cd3b11f3a5c406fbbd4433d8e44d326086db634/airflow/providers/amazon/aws/hooks/base_aws.py#L492-L493
   https://github.com/apache/airflow/blob/0cd3b11f3a5c406fbbd4433d8e44d326086db634/airflow/providers/amazon/aws/hooks/base_aws.py#L508
   What can we do to make this code more consistent?




-- 
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-unsubscribe@airflow.apache.org

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