kaxil commented on a change in pull request #5519:
URL: https://github.com/apache/airflow/pull/5519#discussion_r418987364



##########
File path: airflow/providers/slack/hooks/slack.py
##########
@@ -27,40 +28,62 @@
 # noinspection PyAbstractClass
 class SlackHook(BaseHook):
     """
+    Creates a Slack connection, to be used for calls.
     Takes both Slack API token directly and connection that has Slack API 
token.
-
     If both supplied, Slack API token will be used.
+    Exposes also the rest of slack.WebClient args.
 
     :param token: Slack API token
+    :type token: str
     :param slack_conn_id: connection that has Slack API token in the password 
field
+    :type slack_conn_id: str
+    :param use_session: A boolean specifying if the client should take 
advantage of
+        connection pooling. Default is True.
+    :type use_session: bool
+    :param base_url: A string representing the Slack API base URL. Default is
+        ``https://www.slack.com/api/``
+    :type base_url: str
+    :param timeout: The maximum number of seconds the client will wait
+        to connect and receive a response from Slack. Default is 30 seconds.
+    :type timeout: int
     """
-    def __init__(self, token: Optional[str] = None, slack_conn_id: 
Optional[str] = None) -> None:
+
+    def __init__(
+        self,
+        token: Optional[str] = None,
+        slack_conn_id: Optional[str] = None,
+        **client_args: Any,
+    ) -> None:
         super().__init__()
         self.token = self.__get_token(token, slack_conn_id)
+        self.client_args = client_args
 
     def __get_token(self, token, slack_conn_id):
         if token is not None:
             return token
-        elif slack_conn_id is not None:
+
+        if slack_conn_id is not None:
             conn = self.get_connection(slack_conn_id)
 
             if not getattr(conn, 'password', None):
                 raise AirflowException('Missing token(password) in Slack 
connection')
             return conn.password
-        else:
-            raise AirflowException('Cannot get token: '
-                                   'No valid Slack token nor slack_conn_id 
supplied.')
+
+        raise AirflowException('Cannot get token: '
+                               'No valid Slack token nor slack_conn_id 
supplied.')
 
     def call(self, method: str, api_params: dict) -> None:
         """
-        Calls the Slack client.
+        Creates and calls the Slack client.
 
         :param method: method
         :param api_params: parameters of the API
         """
-        slack_client = SlackClient(self.token)
+        slack_client = WebClient(self.token, **self.client_args)
         return_code = slack_client.api_call(method, **api_params)

Review comment:
       It worked for me after the following change:
   
   ```suggestion
           return_code = slack_client.api_call(method, json=api_params)
   ```




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


Reply via email to