Joffreybvn commented on code in PR #35591:
URL: https://github.com/apache/airflow/pull/35591#discussion_r1403798873


##########
airflow/providers/http/hooks/http.py:
##########
@@ -71,20 +71,13 @@ def __init__(
         self.method = method.upper()
         self.base_url: str = ""
         self._retry_obj: Callable[..., Any]
-        self._auth_type: Any = auth_type
+        self._is_auth_type_setup: bool = auth_type is not None
+        self.auth_type: Any = auth_type
         self.tcp_keep_alive = tcp_keep_alive
         self.keep_alive_idle = tcp_keep_alive_idle
         self.keep_alive_count = tcp_keep_alive_count
         self.keep_alive_interval = tcp_keep_alive_interval
 
-    @property
-    def auth_type(self):
-        return self._auth_type or HTTPBasicAuth
-
-    @auth_type.setter
-    def auth_type(self, v):
-        self._auth_type = v

Review Comment:
   I replaced the auth_type property by a simple class attribute. In a previous 
PR (https://github.com/apache/airflow/pull/29206#pullrequestreview-1274501386 - 
8 months ago), it was introduced as a mechanism to detect if the user passed a 
custom auth class. I replaced that by the `self._is_auth_type_setup` attribute.
   
   _Why ?_ Maintaining this property means adding in it all the logic to load 
and return a auth_type potentially defined in the Connection. Which is useless 
regarding how this property is used in the rest of the codebase ([here in 
livy](https://github.com/apache/airflow/blob/main/airflow/providers/apache/livy/hooks/livy.py#L93),
 and in [dbt 
hook](https://github.com/apache/airflow/blob/main/airflow/providers/dbt/cloud/hooks/dbt.py#L275)).



-- 
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