Skip to content

Commit 15b729d

Browse files
committed
version 1.3.2
1 parent c8ce291 commit 15b729d

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

examples/socket_mode_proxy.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ------------------------------------------------
2+
# instead of slack_bolt in requirements.txt
3+
import sys
4+
5+
sys.path.insert(1, "..")
6+
# ------------------------------------------------
7+
8+
import logging
9+
10+
logging.basicConfig(level=logging.DEBUG)
11+
12+
import os
13+
14+
from slack_sdk import WebClient
15+
from slack_bolt import App
16+
from slack_bolt.adapter.socket_mode import SocketModeHandler
17+
18+
# pip3 install proxy.py
19+
# proxy --port 9000 --log-level d
20+
proxy_url = "http://localhost:9000"
21+
22+
# Install the Slack app and get xoxb- token in advance
23+
app = App(
24+
client=WebClient(token=os.environ["SLACK_BOT_TOKEN"], proxy=proxy_url)
25+
)
26+
27+
28+
@app.event("app_mention")
29+
def event_test(event, say):
30+
say(f"Hi there, <@{event['user']}>!")
31+
32+
33+
if __name__ == "__main__":
34+
# export SLACK_APP_TOKEN=xapp-***
35+
# export SLACK_BOT_TOKEN=xoxb-***
36+
SocketModeHandler(
37+
app=app,
38+
app_token=os.environ["SLACK_APP_TOKEN"],
39+
proxy=proxy_url,
40+
).start()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
exclude=["examples", "integration_tests", "tests", "tests.*",]
3535
),
3636
include_package_data=True, # MANIFEST.in
37-
install_requires=["slack_sdk>=3.3.1,<3.4",],
37+
install_requires=["slack_sdk>=3.3.2,<3.4",],
3838
setup_requires=["pytest-runner==5.2"],
3939
tests_require=test_dependencies,
4040
test_suite="tests",

slack_bolt/adapter/socket_mode/builtin/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from logging import Logger
33
from time import time
4-
from typing import Optional
4+
from typing import Optional, Dict
55

66
from slack_sdk import WebClient
77
from slack_sdk.socket_mode.request import SocketModeRequest
@@ -25,6 +25,7 @@ def __init__( # type: ignore
2525
logger: Optional[Logger] = None,
2626
web_client: Optional[WebClient] = None,
2727
proxy: Optional[str] = None,
28+
proxy_headers: Optional[Dict[str, str]] = None,
2829
auto_reconnect_enabled: bool = True,
2930
trace_enabled: bool = False,
3031
all_message_trace_enabled: bool = False,
@@ -40,6 +41,7 @@ def __init__( # type: ignore
4041
logger=logger if logger is not None else app.logger,
4142
web_client=web_client if web_client is not None else app.client,
4243
proxy=proxy if proxy is not None else app.client.proxy,
44+
proxy_headers=proxy_headers,
4345
auto_reconnect_enabled=auto_reconnect_enabled,
4446
trace_enabled=trace_enabled,
4547
all_message_trace_enabled=all_message_trace_enabled,

slack_bolt/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.1"
1+
__version__ = "1.3.2"

0 commit comments

Comments
 (0)