feng-tao commented on a change in pull request #5066: [AIRFLOW-4262] Ensure 
SlackWebhookHook can take either http_conn_id or webhook_token, or both
URL: https://github.com/apache/airflow/pull/5066#discussion_r273248061
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -57,25 +57,26 @@ def get_conn(self, headers=None):
         :param headers: additional headers to be passed through as a dictionary
         :type headers: dict
         """
-        conn = self.get_connection(self.http_conn_id)
         session = requests.Session()
-
-        if "://" in conn.host:
-            self.base_url = conn.host
-        else:
-            # schema defaults to HTTP
-            schema = conn.schema if conn.schema else "http"
-            self.base_url = schema + "://" + conn.host
-
-        if conn.port:
-            self.base_url = self.base_url + ":" + str(conn.port)
-        if conn.login:
-            session.auth = (conn.login, conn.password)
-        if conn.extra:
-            try:
-                session.headers.update(conn.extra_dejson)
-            except TypeError:
-                self.log.warn('Connection to %s has invalid extra field.', 
conn.host)
+        if self.http_conn_id:
+            conn = self.get_connection(self.http_conn_id)
 
 Review comment:
   what happens if user provides http_conn_id while it is undefined in the 
connection table? Will it throw exception?
   
   Another question would be whether we should raise the exception if user use 
the hook without providing the connection id?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to