Skip to content

Commit a3858ea

Browse files
committed
version 1.11.5
1 parent d323034 commit a3858ea

File tree

5 files changed

+91
-34
lines changed

5 files changed

+91
-34
lines changed

docs/api-docs/slack_bolt/adapter/falcon/resource.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.falcon.resource</code></h1>
2929
<pre><code class="python">from datetime import datetime # type: ignore
3030
from http import HTTPStatus
3131

32-
from falcon import Request, Response
32+
from falcon import Request, Response, version as falcon_version
3333

3434
from slack_bolt import BoltResponse
3535
from slack_bolt.app import App
@@ -78,7 +78,11 @@ <h1 class="title">Module <code>slack_bolt.adapter.falcon.resource</code></h1>
7878
)
7979

8080
def _write_response(self, bolt_resp: BoltResponse, resp: Response):
81-
resp.body = bolt_resp.body
81+
if falcon_version.__version__.startswith(&#34;2.&#34;):
82+
resp.body = bolt_resp.body
83+
else:
84+
resp.text = bolt_resp.body
85+
8286
status = HTTPStatus(bolt_resp.status)
8387
resp.status = str(f&#34;{status.value} {status.phrase}&#34;)
8488
resp.set_headers(bolt_resp.first_headers_without_set_cookie())
@@ -166,7 +170,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>
166170
)
167171

168172
def _write_response(self, bolt_resp: BoltResponse, resp: Response):
169-
resp.body = bolt_resp.body
173+
if falcon_version.__version__.startswith(&#34;2.&#34;):
174+
resp.body = bolt_resp.body
175+
else:
176+
resp.text = bolt_resp.body
177+
170178
status = HTTPStatus(bolt_resp.status)
171179
resp.status = str(f&#34;{status.value} {status.phrase}&#34;)
172180
resp.set_headers(bolt_resp.first_headers_without_set_cookie())

docs/api-docs/slack_bolt/app/async_app.html

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,18 @@ <h1 class="title">Module <code>slack_bolt.app.async_app</code></h1>
474474
from .async_server import AsyncSlackAppServer
475475

476476
def server(
477-
self, port: int = 3000, path: str = &#34;/slack/events&#34;
477+
self,
478+
port: int = 3000,
479+
path: str = &#34;/slack/events&#34;,
480+
host: Optional[str] = None,
478481
) -&gt; AsyncSlackAppServer:
479482
&#34;&#34;&#34;Configure a web server using AIOHTTP.
480483
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
481484

482485
Args:
483486
port: The port to listen on (Default: 3000)
484-
path:The path to handle request from Slack (Default: `/slack/events`)
487+
path: The path to handle request from Slack (Default: `/slack/events`)
488+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
485489
&#34;&#34;&#34;
486490
if (
487491
self._server is None
@@ -492,6 +496,7 @@ <h1 class="title">Module <code>slack_bolt.app.async_app</code></h1>
492496
port=port,
493497
path=path,
494498
app=self,
499+
host=host,
495500
)
496501
return self._server
497502

@@ -516,15 +521,18 @@ <h1 class="title">Module <code>slack_bolt.app.async_app</code></h1>
516521
&#34;&#34;&#34;
517522
return self.server(path=path).web_app
518523

519-
def start(self, port: int = 3000, path: str = &#34;/slack/events&#34;) -&gt; None:
524+
def start(
525+
self, port: int = 3000, path: str = &#34;/slack/events&#34;, host: Optional[str] = None
526+
) -&gt; None:
520527
&#34;&#34;&#34;Start a web server using AIOHTTP.
521528
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
522529

523530
Args:
524531
port: The port to listen on (Default: 3000)
525-
path:The path to handle request from Slack (Default: `/slack/events`)
532+
path: The path to handle request from Slack (Default: `/slack/events`)
533+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
526534
&#34;&#34;&#34;
527-
self.server(port=port, path=path).start()
535+
self.server(port=port, path=path, host=host).start()
528536

529537
# -------------------------
530538
# main dispatcher
@@ -1866,14 +1874,18 @@ <h2 id="args">Args</h2>
18661874
from .async_server import AsyncSlackAppServer
18671875

18681876
def server(
1869-
self, port: int = 3000, path: str = &#34;/slack/events&#34;
1877+
self,
1878+
port: int = 3000,
1879+
path: str = &#34;/slack/events&#34;,
1880+
host: Optional[str] = None,
18701881
) -&gt; AsyncSlackAppServer:
18711882
&#34;&#34;&#34;Configure a web server using AIOHTTP.
18721883
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
18731884

18741885
Args:
18751886
port: The port to listen on (Default: 3000)
1876-
path:The path to handle request from Slack (Default: `/slack/events`)
1887+
path: The path to handle request from Slack (Default: `/slack/events`)
1888+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
18771889
&#34;&#34;&#34;
18781890
if (
18791891
self._server is None
@@ -1884,6 +1896,7 @@ <h2 id="args">Args</h2>
18841896
port=port,
18851897
path=path,
18861898
app=self,
1899+
host=host,
18871900
)
18881901
return self._server
18891902

@@ -1908,15 +1921,18 @@ <h2 id="args">Args</h2>
19081921
&#34;&#34;&#34;
19091922
return self.server(path=path).web_app
19101923

1911-
def start(self, port: int = 3000, path: str = &#34;/slack/events&#34;) -&gt; None:
1924+
def start(
1925+
self, port: int = 3000, path: str = &#34;/slack/events&#34;, host: Optional[str] = None
1926+
) -&gt; None:
19121927
&#34;&#34;&#34;Start a web server using AIOHTTP.
19131928
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
19141929

19151930
Args:
19161931
port: The port to listen on (Default: 3000)
1917-
path:The path to handle request from Slack (Default: `/slack/events`)
1932+
path: The path to handle request from Slack (Default: `/slack/events`)
1933+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
19181934
&#34;&#34;&#34;
1919-
self.server(port=port, path=path).start()
1935+
self.server(port=port, path=path, host=host).start()
19201936

19211937
# -------------------------
19221938
# main dispatcher
@@ -3856,7 +3872,7 @@ <h2 id="args">Args</h2>
38563872
</details>
38573873
</dd>
38583874
<dt id="slack_bolt.app.async_app.AsyncApp.server"><code class="name flex">
3859-
<span>def <span class="ident">server</span></span>(<span>self, port: int = 3000, path: str = '/slack/events') ‑> <a title="slack_bolt.app.async_server.AsyncSlackAppServer" href="async_server.html#slack_bolt.app.async_server.AsyncSlackAppServer">AsyncSlackAppServer</a></span>
3875+
<span>def <span class="ident">server</span></span>(<span>self, port: int = 3000, path: str = '/slack/events', host: Optional[str] = None) ‑> <a title="slack_bolt.app.async_server.AsyncSlackAppServer" href="async_server.html#slack_bolt.app.async_server.AsyncSlackAppServer">AsyncSlackAppServer</a></span>
38603876
</code></dt>
38613877
<dd>
38623878
<div class="desc"><p>Configure a web server using AIOHTTP.
@@ -3865,21 +3881,28 @@ <h2 id="args">Args</h2>
38653881
<dl>
38663882
<dt><strong><code>port</code></strong></dt>
38673883
<dd>The port to listen on (Default: 3000)</dd>
3868-
</dl>
3869-
<p>path:The path to handle request from Slack (Default: <code>/slack/events</code>)</p></div>
3884+
<dt><strong><code>path</code></strong></dt>
3885+
<dd>The path to handle request from Slack (Default: <code>/slack/events</code>)</dd>
3886+
<dt><strong><code>host</code></strong></dt>
3887+
<dd>The hostname to serve the web endpoints. (Default: 0.0.0.0)</dd>
3888+
</dl></div>
38703889
<details class="source">
38713890
<summary>
38723891
<span>Expand source code</span>
38733892
</summary>
38743893
<pre><code class="python">def server(
3875-
self, port: int = 3000, path: str = &#34;/slack/events&#34;
3894+
self,
3895+
port: int = 3000,
3896+
path: str = &#34;/slack/events&#34;,
3897+
host: Optional[str] = None,
38763898
) -&gt; AsyncSlackAppServer:
38773899
&#34;&#34;&#34;Configure a web server using AIOHTTP.
38783900
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
38793901

38803902
Args:
38813903
port: The port to listen on (Default: 3000)
3882-
path:The path to handle request from Slack (Default: `/slack/events`)
3904+
path: The path to handle request from Slack (Default: `/slack/events`)
3905+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
38833906
&#34;&#34;&#34;
38843907
if (
38853908
self._server is None
@@ -3890,6 +3913,7 @@ <h2 id="args">Args</h2>
38903913
port=port,
38913914
path=path,
38923915
app=self,
3916+
host=host,
38933917
)
38943918
return self._server</code></pre>
38953919
</details>
@@ -3981,7 +4005,7 @@ <h2 id="args">Args</h2>
39814005
</details>
39824006
</dd>
39834007
<dt id="slack_bolt.app.async_app.AsyncApp.start"><code class="name flex">
3984-
<span>def <span class="ident">start</span></span>(<span>self, port: int = 3000, path: str = '/slack/events') ‑> None</span>
4008+
<span>def <span class="ident">start</span></span>(<span>self, port: int = 3000, path: str = '/slack/events', host: Optional[str] = None) ‑> None</span>
39854009
</code></dt>
39864010
<dd>
39874011
<div class="desc"><p>Start a web server using AIOHTTP.
@@ -3990,21 +4014,27 @@ <h2 id="args">Args</h2>
39904014
<dl>
39914015
<dt><strong><code>port</code></strong></dt>
39924016
<dd>The port to listen on (Default: 3000)</dd>
3993-
</dl>
3994-
<p>path:The path to handle request from Slack (Default: <code>/slack/events</code>)</p></div>
4017+
<dt><strong><code>path</code></strong></dt>
4018+
<dd>The path to handle request from Slack (Default: <code>/slack/events</code>)</dd>
4019+
<dt><strong><code>host</code></strong></dt>
4020+
<dd>The hostname to serve the web endpoints. (Default: 0.0.0.0)</dd>
4021+
</dl></div>
39954022
<details class="source">
39964023
<summary>
39974024
<span>Expand source code</span>
39984025
</summary>
3999-
<pre><code class="python">def start(self, port: int = 3000, path: str = &#34;/slack/events&#34;) -&gt; None:
4026+
<pre><code class="python">def start(
4027+
self, port: int = 3000, path: str = &#34;/slack/events&#34;, host: Optional[str] = None
4028+
) -&gt; None:
40004029
&#34;&#34;&#34;Start a web server using AIOHTTP.
40014030
Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
40024031

40034032
Args:
40044033
port: The port to listen on (Default: 3000)
4005-
path:The path to handle request from Slack (Default: `/slack/events`)
4034+
path: The path to handle request from Slack (Default: `/slack/events`)
4035+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
40064036
&#34;&#34;&#34;
4007-
self.server(port=port, path=path).start()</code></pre>
4037+
self.server(port=port, path=path, host=host).start()</code></pre>
40084038
</details>
40094039
</dd>
40104040
<dt id="slack_bolt.app.async_app.AsyncApp.step"><code class="name flex">

docs/api-docs/slack_bolt/app/async_server.html

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h1 class="title">Module <code>slack_bolt.app.async_server</code></h1>
2727
<span>Expand source code</span>
2828
</summary>
2929
<pre><code class="python">import logging
30+
from typing import Optional
3031

3132
from aiohttp import web
3233

@@ -38,6 +39,7 @@ <h1 class="title">Module <code>slack_bolt.app.async_server</code></h1>
3839
class AsyncSlackAppServer:
3940
port: int
4041
path: str
42+
host: str
4143
bolt_app: &#34;AsyncApp&#34; # type:ignore
4244
web_app: web.Application
4345

@@ -46,6 +48,7 @@ <h1 class="title">Module <code>slack_bolt.app.async_server</code></h1>
4648
port: int,
4749
path: str,
4850
app: &#34;AsyncApp&#34;, # type:ignore
51+
host: Optional[str] = None,
4952
):
5053
&#34;&#34;&#34;Standalone AIOHTTP Web Server.
5154
Refer to https://docs.aiohttp.org/en/stable/web.html for details of AIOHTTP.
@@ -54,9 +57,11 @@ <h1 class="title">Module <code>slack_bolt.app.async_server</code></h1>
5457
port: The port to listen on
5558
path: The path to receive incoming requests from Slack
5659
app: The `AsyncApp` instance that is used for processing requests
60+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
5761
&#34;&#34;&#34;
5862
self.port = port
5963
self.path = path
64+
self.host = host if host is not None else &#34;0.0.0.0&#34;
6065
self.bolt_app: &#34;AsyncApp&#34; = app # type: ignore
6166
self.web_app = web.Application()
6267
self._bolt_oauth_flow = self.bolt_app.oauth_flow
@@ -100,14 +105,15 @@ <h1 class="title">Module <code>slack_bolt.app.async_server</code></h1>
100105
bolt_resp: BoltResponse = await self.bolt_app.async_dispatch(bolt_req)
101106
return await to_aiohttp_response(bolt_resp)
102107

103-
def start(self) -&gt; None:
108+
def start(self, host: Optional[str] = None) -&gt; None:
104109
&#34;&#34;&#34;Starts a new web server process.&#34;&#34;&#34;
105110
if self.bolt_app.logger.level &gt; logging.INFO:
106111
print(get_boot_message())
107112
else:
108113
self.bolt_app.logger.info(get_boot_message())
109114

110-
web.run_app(self.web_app, host=&#34;0.0.0.0&#34;, port=self.port)</code></pre>
115+
_host = host if host is not None else self.host
116+
web.run_app(self.web_app, host=_host, port=self.port)</code></pre>
111117
</details>
112118
</section>
113119
<section>
@@ -121,7 +127,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
121127
<dl>
122128
<dt id="slack_bolt.app.async_server.AsyncSlackAppServer"><code class="flex name class">
123129
<span>class <span class="ident">AsyncSlackAppServer</span></span>
124-
<span>(</span><span>port: int, path: str, app: AsyncApp)</span>
130+
<span>(</span><span>port: int, path: str, app: AsyncApp, host: Optional[str] = None)</span>
125131
</code></dt>
126132
<dd>
127133
<div class="desc"><p>Standalone AIOHTTP Web Server.
@@ -134,6 +140,8 @@ <h2 id="args">Args</h2>
134140
<dd>The path to receive incoming requests from Slack</dd>
135141
<dt><strong><code>app</code></strong></dt>
136142
<dd>The <code>AsyncApp</code> instance that is used for processing requests</dd>
143+
<dt><strong><code>host</code></strong></dt>
144+
<dd>The hostname to serve the web endpoints. (Default: 0.0.0.0)</dd>
137145
</dl></div>
138146
<details class="source">
139147
<summary>
@@ -142,6 +150,7 @@ <h2 id="args">Args</h2>
142150
<pre><code class="python">class AsyncSlackAppServer:
143151
port: int
144152
path: str
153+
host: str
145154
bolt_app: &#34;AsyncApp&#34; # type:ignore
146155
web_app: web.Application
147156

@@ -150,6 +159,7 @@ <h2 id="args">Args</h2>
150159
port: int,
151160
path: str,
152161
app: &#34;AsyncApp&#34;, # type:ignore
162+
host: Optional[str] = None,
153163
):
154164
&#34;&#34;&#34;Standalone AIOHTTP Web Server.
155165
Refer to https://docs.aiohttp.org/en/stable/web.html for details of AIOHTTP.
@@ -158,9 +168,11 @@ <h2 id="args">Args</h2>
158168
port: The port to listen on
159169
path: The path to receive incoming requests from Slack
160170
app: The `AsyncApp` instance that is used for processing requests
171+
host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
161172
&#34;&#34;&#34;
162173
self.port = port
163174
self.path = path
175+
self.host = host if host is not None else &#34;0.0.0.0&#34;
164176
self.bolt_app: &#34;AsyncApp&#34; = app # type: ignore
165177
self.web_app = web.Application()
166178
self._bolt_oauth_flow = self.bolt_app.oauth_flow
@@ -204,21 +216,26 @@ <h2 id="args">Args</h2>
204216
bolt_resp: BoltResponse = await self.bolt_app.async_dispatch(bolt_req)
205217
return await to_aiohttp_response(bolt_resp)
206218

207-
def start(self) -&gt; None:
219+
def start(self, host: Optional[str] = None) -&gt; None:
208220
&#34;&#34;&#34;Starts a new web server process.&#34;&#34;&#34;
209221
if self.bolt_app.logger.level &gt; logging.INFO:
210222
print(get_boot_message())
211223
else:
212224
self.bolt_app.logger.info(get_boot_message())
213225

214-
web.run_app(self.web_app, host=&#34;0.0.0.0&#34;, port=self.port)</code></pre>
226+
_host = host if host is not None else self.host
227+
web.run_app(self.web_app, host=_host, port=self.port)</code></pre>
215228
</details>
216229
<h3>Class variables</h3>
217230
<dl>
218231
<dt id="slack_bolt.app.async_server.AsyncSlackAppServer.bolt_app"><code class="name">var <span class="ident">bolt_app</span> : AsyncApp</code></dt>
219232
<dd>
220233
<div class="desc"></div>
221234
</dd>
235+
<dt id="slack_bolt.app.async_server.AsyncSlackAppServer.host"><code class="name">var <span class="ident">host</span> : str</code></dt>
236+
<dd>
237+
<div class="desc"></div>
238+
</dd>
222239
<dt id="slack_bolt.app.async_server.AsyncSlackAppServer.path"><code class="name">var <span class="ident">path</span> : str</code></dt>
223240
<dd>
224241
<div class="desc"></div>
@@ -279,22 +296,23 @@ <h3>Methods</h3>
279296
</details>
280297
</dd>
281298
<dt id="slack_bolt.app.async_server.AsyncSlackAppServer.start"><code class="name flex">
282-
<span>def <span class="ident">start</span></span>(<span>self) ‑> None</span>
299+
<span>def <span class="ident">start</span></span>(<span>self, host: Optional[str] = None) ‑> None</span>
283300
</code></dt>
284301
<dd>
285302
<div class="desc"><p>Starts a new web server process.</p></div>
286303
<details class="source">
287304
<summary>
288305
<span>Expand source code</span>
289306
</summary>
290-
<pre><code class="python">def start(self) -&gt; None:
307+
<pre><code class="python">def start(self, host: Optional[str] = None) -&gt; None:
291308
&#34;&#34;&#34;Starts a new web server process.&#34;&#34;&#34;
292309
if self.bolt_app.logger.level &gt; logging.INFO:
293310
print(get_boot_message())
294311
else:
295312
self.bolt_app.logger.info(get_boot_message())
296313

297-
web.run_app(self.web_app, host=&#34;0.0.0.0&#34;, port=self.port)</code></pre>
314+
_host = host if host is not None else self.host
315+
web.run_app(self.web_app, host=_host, port=self.port)</code></pre>
298316
</details>
299317
</dd>
300318
</dl>
@@ -321,6 +339,7 @@ <h4><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer" href="#slac
321339
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.bolt_app" href="#slack_bolt.app.async_server.AsyncSlackAppServer.bolt_app">bolt_app</a></code></li>
322340
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.handle_get_requests" href="#slack_bolt.app.async_server.AsyncSlackAppServer.handle_get_requests">handle_get_requests</a></code></li>
323341
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.handle_post_requests" href="#slack_bolt.app.async_server.AsyncSlackAppServer.handle_post_requests">handle_post_requests</a></code></li>
342+
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.host" href="#slack_bolt.app.async_server.AsyncSlackAppServer.host">host</a></code></li>
324343
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.path" href="#slack_bolt.app.async_server.AsyncSlackAppServer.path">path</a></code></li>
325344
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.port" href="#slack_bolt.app.async_server.AsyncSlackAppServer.port">port</a></code></li>
326345
<li><code><a title="slack_bolt.app.async_server.AsyncSlackAppServer.start" href="#slack_bolt.app.async_server.AsyncSlackAppServer.start">start</a></code></li>

0 commit comments

Comments
 (0)