Skip to content

Commit

Permalink
version 1.20.1 (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamBergamin authored Aug 23, 2024
1 parent 6f4854b commit 3aa9c30
Show file tree
Hide file tree
Showing 125 changed files with 721 additions and 662 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ <h2 id="args">Args</h2>
)

async def handle_installation(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
return await oauth_flow.handle_installation(
return await self.app.oauth_flow.handle_installation( # type: ignore[union-attr]
AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)

async def handle_callback(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
return await oauth_flow.handle_callback(
return await self.app.oauth_flow.handle_callback( # type: ignore[union-attr]
AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)</code></pre>
</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ <h2 id="args">Args</h2>
)

async def handle_installation(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
return await oauth_flow.handle_installation(
return await self.app.oauth_flow.handle_installation( # type: ignore[union-attr]
AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)

async def handle_callback(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
return await oauth_flow.handle_callback(
return await self.app.oauth_flow.handle_callback( # type: ignore[union-attr]
AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)</code></pre>
</details>
Expand Down
14 changes: 7 additions & 7 deletions docs/static/api-docs/slack_bolt/adapter/asgi/base_handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class BaseSlackRequestHandler:
app: App # type: ignore
app: Union[App, &#34;AsyncApp&#34;] # type: ignore[name-defined]
path: str

async def dispatch(self, request: AsgiHttpRequest) -&gt; BoltResponse:
Expand All @@ -68,13 +68,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
return AsgiHttpResponse(
status=bolt_response.status, headers=bolt_response.headers, body=bolt_response.body
)
if path == self.app.oauth_flow.redirect_uri_path:
bolt_response: BoltResponse = await self.handle_callback(request)
elif path == self.app.oauth_flow.redirect_uri_path:
bolt_response = await self.handle_callback(request)
return AsgiHttpResponse(
status=bolt_response.status, headers=bolt_response.headers, body=bolt_response.body
)
if method == &#34;POST&#34; and path == self.path:
bolt_response: BoltResponse = await self.dispatch(request)
bolt_response = await self.dispatch(request)
return AsgiHttpResponse(status=bolt_response.status, headers=bolt_response.headers, body=bolt_response.body)
return AsgiHttpResponse(status=404, headers={&#34;content-type&#34;: [&#34;text/plain;charset=utf-8&#34;]}, body=&#34;Not Found&#34;)

Expand All @@ -91,23 +91,23 @@ <h2 class="section-title" id="header-classes">Classes</h2>
async def __call__(self, scope: scope_type, receive: Callable, send: Callable) -&gt; None:
if scope[&#34;type&#34;] == &#34;http&#34;:
response: AsgiHttpResponse = await self._get_http_response(
scope[&#34;method&#34;], scope[&#34;path&#34;], AsgiHttpRequest(scope, receive)
method=scope[&#34;method&#34;], path=scope[&#34;path&#34;], request=AsgiHttpRequest(scope, receive) # type: ignore[arg-type]
)
await send(response.get_response_start())
await send(response.get_response_body())
return
if scope[&#34;type&#34;] == &#34;lifespan&#34;:
await send(await self._handle_lifespan(receive))
return
raise TypeError(f&#34;Unsupported scope type: {scope[&#39;type&#39;]}&#34;)</code></pre>
raise TypeError(f&#34;Unsupported scope type: {scope[&#39;type&#39;]!r}&#34;)</code></pre>
</details>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="slack_bolt.adapter.asgi.builtin.SlackRequestHandler" href="builtin/index.html#slack_bolt.adapter.asgi.builtin.SlackRequestHandler">SlackRequestHandler</a></li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="slack_bolt.adapter.asgi.base_handler.BaseSlackRequestHandler.app"><code class="name">var <span class="ident">app</span><a title="slack_bolt.app.app.App" href="../../app/app.html#slack_bolt.app.app.App">App</a></code></dt>
<dt id="slack_bolt.adapter.asgi.base_handler.BaseSlackRequestHandler.app"><code class="name">var <span class="ident">app</span>Union[<a title="slack_bolt.app.app.App" href="../../app/app.html#slack_bolt.app.app.App">App</a>, AsyncApp]</code></dt>
<dd>
<div class="desc"></div>
</dd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h2 id="args">Args</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler(BaseSlackRequestHandler):
def __init__(self, app: App, path: str = &#34;/slack/events&#34;): # type: ignore
def __init__(self, app: App, path: str = &#34;/slack/events&#34;):
&#34;&#34;&#34;Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers.
This can be used for production deployment.

Expand Down Expand Up @@ -94,14 +94,12 @@ <h2 id="args">Args</h2>
)

async def handle_installation(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: OAuthFlow = self.app.oauth_flow
return oauth_flow.handle_installation(
return self.app.oauth_flow.handle_installation( # type: ignore[union-attr]
BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)

async def handle_callback(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: OAuthFlow = self.app.oauth_flow
return oauth_flow.handle_callback(
return self.app.oauth_flow.handle_callback( # type: ignore[union-attr]
BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)</code></pre>
</details>
Expand Down
10 changes: 5 additions & 5 deletions docs/static/api-docs/slack_bolt/adapter/asgi/http_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ <h2 class="section-title" id="header-classes">Classes</h2>

def __init__(self, scope: scope_type, receive: Callable):
self.receive = receive
self.query_string = str(scope[&#34;query_string&#34;], ENCODING)
self.raw_headers = scope[&#34;headers&#34;]
self.query_string = str(scope[&#34;query_string&#34;], ENCODING) # type: ignore[arg-type]
self.raw_headers: Iterable[Tuple[bytes, bytes]] = scope[&#34;headers&#34;] # type: ignore[assignment]

def get_headers(self) -&gt; Dict[str, str]:
def get_headers(self) -&gt; Dict[str, Union[str, Sequence[str]]]:
return {str(header[0], ENCODING): str(header[1], (ENCODING)) for header in self.raw_headers}

async def get_raw_body(self) -&gt; str:
Expand All @@ -64,7 +64,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
if chunk[&#34;type&#34;] != &#34;http.request&#34;:
raise Exception(&#34;Body chunks could not be received from asgi server&#34;)

chunks.extend(chunk.get(&#34;body&#34;, b&#34;&#34;))
chunks.extend(chunk.get(&#34;body&#34;, b&#34;&#34;)) # type: ignore[arg-type]
if not chunk.get(&#34;more_body&#34;, False):
break
return bytes(chunks).decode(ENCODING)</code></pre>
Expand All @@ -87,7 +87,7 @@ <h3>Instance variables</h3>
<h3>Methods</h3>
<dl>
<dt id="slack_bolt.adapter.asgi.http_request.AsgiHttpRequest.get_headers"><code class="name flex">
<span>def <span class="ident">get_headers</span></span>(<span>self) ‑> Dict[str, str]</span>
<span>def <span class="ident">get_headers</span></span>(<span>self) ‑> Dict[str, Union[str, Sequence[str]]]</span>
</code></dt>
<dd>
<div class="desc"></div>
Expand Down
8 changes: 3 additions & 5 deletions docs/static/api-docs/slack_bolt/adapter/asgi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2 id="args">Args</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler(BaseSlackRequestHandler):
def __init__(self, app: App, path: str = &#34;/slack/events&#34;): # type: ignore
def __init__(self, app: App, path: str = &#34;/slack/events&#34;):
&#34;&#34;&#34;Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers.
This can be used for production deployment.

Expand Down Expand Up @@ -125,14 +125,12 @@ <h2 id="args">Args</h2>
)

async def handle_installation(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: OAuthFlow = self.app.oauth_flow
return oauth_flow.handle_installation(
return self.app.oauth_flow.handle_installation( # type: ignore[union-attr]
BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)

async def handle_callback(self, request: AsgiHttpRequest) -&gt; BoltResponse:
oauth_flow: OAuthFlow = self.app.oauth_flow
return oauth_flow.handle_callback(
return self.app.oauth_flow.handle_callback( # type: ignore[union-attr]
BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers())
)</code></pre>
</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class ChaliceSlackRequestHandler:
def __init__(self, app: App, chalice: Chalice, lambda_client: Optional[BaseClient] = None): # type: ignore
def __init__(self, app: App, chalice: Chalice, lambda_client: Optional[BaseClient] = None):
self.app = app
self.chalice = chalice
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler, app.logger)
Expand All @@ -78,7 +78,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
LocalLambdaClient,
)

lambda_client = LocalLambdaClient(self.chalice, None)
lambda_client = LocalLambdaClient(self.chalice, None) # type: ignore[arg-type]
except ImportError:
logging.info(&#34;Failed to load LocalLambdaClient for CLI mode.&#34;)
pass
Expand All @@ -99,7 +99,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
root.removeHandler(handler)

def handle(self, request: Request):
body: str = request.raw_body.decode(&#34;utf-8&#34;) if request.raw_body else &#34;&#34;
body: str = request.raw_body.decode(&#34;utf-8&#34;) if request.raw_body else &#34;&#34; # type: ignore[union-attr]
self.logger.debug(f&#34;Incoming request: {request.to_dict()}, body: {body}&#34;)

method = request.method
Expand All @@ -121,7 +121,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
bolt_resp = oauth_flow.handle_installation(bolt_req)
return to_chalice_response(bolt_resp)
elif method == &#34;POST&#34;:
bolt_req: BoltRequest = to_bolt_request(request, body)
bolt_req = to_bolt_request(request, body)
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = self.chalice.lambda_context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
Expand All @@ -130,7 +130,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
aws_response = to_chalice_response(bolt_resp)
return aws_response
elif method == &#34;NONE&#34;:
bolt_req: BoltRequest = to_bolt_request(request, body)
bolt_req = to_bolt_request(request, body)
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_chalice_response(bolt_resp)
return aws_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>

chalice_request: dict = request.context[&#34;chalice_request&#34;]
request.headers[&#34;x-slack-bolt-lazy-only&#34;] = [&#34;1&#34;]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [request.lazy_function_name]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [request.lazy_function_name] # type: ignore[list-item]
payload = {
&#34;method&#34;: &#34;NONE&#34;,
&#34;headers&#34;: {k: v[0] for k, v in request.headers.items()},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/bottle/handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def handle(self, req: Request, resp: Response) -&gt; str:
Expand All @@ -77,7 +77,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
set_response(bolt_resp, resp)
return bolt_resp.body or &#34;&#34;
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(req))
bolt_resp = self.app.dispatch(to_bolt_request(req))
set_response(bolt_resp, resp)
return bolt_resp.body or &#34;&#34;

Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/bottle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def handle(self, req: Request, resp: Response) -&gt; str:
Expand All @@ -69,7 +69,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
set_response(bolt_resp, resp)
return bolt_resp.body or &#34;&#34;
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(req))
bolt_resp = self.app.dispatch(to_bolt_request(req))
set_response(bolt_resp, resp)
return bolt_resp.body or &#34;&#34;

Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/cherrypy/handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def handle(self) -&gt; bytes:
Expand All @@ -85,7 +85,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
set_response_status_and_headers(bolt_resp)
return (bolt_resp.body or &#34;&#34;).encode(&#34;utf-8&#34;)
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(build_bolt_request())
bolt_resp = self.app.dispatch(build_bolt_request())
set_response_status_and_headers(bolt_resp)
return (bolt_resp.body or &#34;&#34;).encode(&#34;utf-8&#34;)

Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/cherrypy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def handle(self) -&gt; bytes:
Expand All @@ -71,7 +71,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
set_response_status_and_headers(bolt_resp)
return (bolt_resp.body or &#34;&#34;).encode(&#34;utf-8&#34;)
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(build_bolt_request())
bolt_resp = self.app.dispatch(build_bolt_request())
set_response_status_and_headers(bolt_resp)
return (bolt_resp.body or &#34;&#34;).encode(&#34;utf-8&#34;)

Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/django/handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h3>Inherited members</h3>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app
listener_runner = self.app.listener_runner
# This runner closes all thread-local connections in the thread when an execution completes
Expand Down Expand Up @@ -238,7 +238,7 @@ <h3>Inherited members</h3>
bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
return to_django_response(bolt_resp)
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(req))
bolt_resp = self.app.dispatch(to_bolt_request(req))
return to_django_response(bolt_resp)

return HttpResponse(status=404, content=b&#34;Not Found&#34;)</code></pre>
Expand Down
4 changes: 2 additions & 2 deletions docs/static/api-docs/slack_bolt/adapter/django/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SlackRequestHandler:
def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app
listener_runner = self.app.listener_runner
# This runner closes all thread-local connections in the thread when an execution completes
Expand Down Expand Up @@ -116,7 +116,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
return to_django_response(bolt_resp)
elif req.method == &#34;POST&#34;:
bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(req))
bolt_resp = self.app.dispatch(to_bolt_request(req))
return to_django_response(bolt_resp)

return HttpResponse(status=404, content=b&#34;Not Found&#34;)</code></pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
app.add_route(&#34;/slack/events&#34;, AsyncSlackAppResource(app))
&#34;&#34;&#34;

def __init__(self, app: AsyncApp): # type: ignore
def __init__(self, app: AsyncApp):
if falcon_version.__version__.startswith(&#34;2.&#34;):
raise BoltError(&#34;This ASGI compatible adapter requires Falcon version &gt;= 3.0&#34;)

Expand Down
2 changes: 1 addition & 1 deletion docs/static/api-docs/slack_bolt/adapter/falcon/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
api.add_route(&#34;/slack/events&#34;, SlackAppResource(app))
&#34;&#34;&#34;

def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def on_get(self, req: Request, resp: Response):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
api.add_route(&#34;/slack/events&#34;, SlackAppResource(app))
&#34;&#34;&#34;

def __init__(self, app: App): # type: ignore
def __init__(self, app: App):
self.app = app

def on_get(self, req: Request, resp: Response):
Expand Down
Loading

0 comments on commit 3aa9c30

Please sign in to comment.