Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
@property
def client(self) -> WebClient:
if self._client is None:
self._client = create_web_client()
self._client = create_web_client(logger=self.logger)
return self._client

@property
Expand Down
6 changes: 5 additions & 1 deletion slack_bolt/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def __init__(
warning_client_prioritized_and_token_skipped()
)
else:
self._client = create_web_client(token) # NOTE: the token here can be None
self._client = create_web_client(
# NOTE: the token here can be None
token=token,
logger=self._framework_logger,
)

# --------------------------------------
# Authorize & OAuthFlow initialization
Expand Down
7 changes: 5 additions & 2 deletions slack_bolt/app/async_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ def __init__(
warning_client_prioritized_and_token_skipped()
)
else:
# NOTE: the token here can be None
self._async_client = create_async_web_client(token)
self._async_client = create_async_web_client(
# NOTE: the token here can be None
token=token,
logger=self._framework_logger,
)

# --------------------------------------
# Authorize & OAuthFlow initialization
Expand Down
2 changes: 1 addition & 1 deletion slack_bolt/oauth/async_oauth_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AsyncOAuthFlow:
@property
def client(self) -> AsyncWebClient:
if self._async_client is None:
self._async_client = create_async_web_client()
self._async_client = create_async_web_client(logger=self.logger)
return self._async_client

@property
Expand Down
2 changes: 1 addition & 1 deletion slack_bolt/oauth/oauth_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class OAuthFlow:
@property
def client(self) -> WebClient:
if self._client is None:
self._client = create_web_client()
self._client = create_web_client(logger=self.logger)
return self._client

@property
Expand Down
6 changes: 5 additions & 1 deletion slack_bolt/util/async_utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from logging import Logger
from typing import Optional

from slack_sdk.web.async_client import AsyncWebClient

from slack_bolt.version import __version__ as bolt_version


def create_async_web_client(token: Optional[str] = None) -> AsyncWebClient:
def create_async_web_client(
token: Optional[str] = None, logger: Optional[Logger] = None
) -> AsyncWebClient:
return AsyncWebClient(
token=token,
logger=logger,
user_agent_prefix=f"Bolt-Async/{bolt_version}",
)
6 changes: 5 additions & 1 deletion slack_bolt/util/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import sys
from logging import Logger
from typing import Optional, Union, Dict, Any, Sequence, Callable

from slack_sdk import WebClient
Expand All @@ -9,9 +10,12 @@
from slack_bolt.version import __version__ as bolt_version


def create_web_client(token: Optional[str] = None) -> WebClient:
def create_web_client(
token: Optional[str] = None, logger: Optional[Logger] = None
) -> WebClient:
return WebClient(
token=token,
logger=logger,
user_agent_prefix=f"Bolt/{bolt_version}",
)

Expand Down