Skip to content

Commit 9466e7c

Browse files
Merge branch 'main' into docs-stream-change
2 parents 5b11ff9 + 4547d73 commit 9466e7c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

slack_sdk/signature/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import hashlib
44
import hmac
55
from time import time
6-
from typing import Dict, Optional, Union
6+
from typing import Dict, Optional, Union, TYPE_CHECKING
7+
8+
# Fallback to Dict for Python 3.7/3.8 compatibility (safe to remove once these versions are no longer supported)
9+
if TYPE_CHECKING:
10+
from collections.abc import Mapping
11+
else:
12+
Mapping = Dict
713

814

915
class Clock:
@@ -26,23 +32,23 @@ def __init__(self, signing_secret: str, clock: Clock = Clock()):
2632
def is_valid_request(
2733
self,
2834
body: Union[str, bytes],
29-
headers: Dict[str, str],
35+
headers: Mapping[str, str],
3036
) -> bool:
3137
"""Verifies if the given signature is valid"""
3238
if headers is None:
3339
return False
3440
normalized_headers = {k.lower(): v for k, v in headers.items()}
3541
return self.is_valid(
3642
body=body,
37-
timestamp=normalized_headers.get("x-slack-request-timestamp", None), # type: ignore[arg-type]
38-
signature=normalized_headers.get("x-slack-signature", None), # type: ignore[arg-type]
43+
timestamp=normalized_headers.get("x-slack-request-timestamp", None),
44+
signature=normalized_headers.get("x-slack-signature", None),
3945
)
4046

4147
def is_valid(
4248
self,
4349
body: Union[str, bytes],
44-
timestamp: str,
45-
signature: str,
50+
timestamp: Optional[str],
51+
signature: Optional[str],
4652
) -> bool:
4753
"""Verifies if the given signature is valid"""
4854
if timestamp is None or signature is None:

slack_sdk/socket_mode/aiohttp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ async def connect(self):
379379
autoping=False,
380380
heartbeat=self.ping_interval,
381381
proxy=self.proxy,
382-
ssl=self.web_client.ssl,
382+
ssl=self.web_client.ssl if self.web_client.ssl is not None else True,
383383
)
384384
session_id: str = await self.session_id()
385385
self.auto_reconnect_enabled = self.default_auto_reconnect_enabled

0 commit comments

Comments
 (0)