Skip to content

Commit

Permalink
Update the documents
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Jun 14, 2022
1 parent 92f2ad2 commit ddffefc
Show file tree
Hide file tree
Showing 92 changed files with 2,105 additions and 5,844 deletions.
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2028c7514a2495d4a303c389eaf023c5
config: 63236e700a8b879338135cc5819717ea
tags: 645f666f9bcd5a90fca523b33c5a78b7
8 changes: 2 additions & 6 deletions docs/api-docs/slack_sdk/aiohttp_version_checker.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ <h1 class="title">Module <code>slack_sdk.aiohttp_version_checker</code></h1>
if len(elements) &gt;= 3:
# patch version can be a non-numeric value
major, minor, patch = int(elements[0]), int(elements[1]), elements[2]
if major &lt;= 2 or (
major == 3 and (minor == 6 or (minor == 7 and patch == &#34;0&#34;))
):
if major &lt;= 2 or (major == 3 and (minor == 6 or (minor == 7 and patch == &#34;0&#34;))):
print_warning(
&#34;We highly recommend upgrading aiohttp to 3.7.3 or higher versions.&#34;
&#34;An older version of the library may not work with the Slack server-side in the future.&#34;
Expand Down Expand Up @@ -79,9 +77,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
if len(elements) &gt;= 3:
# patch version can be a non-numeric value
major, minor, patch = int(elements[0]), int(elements[1]), elements[2]
if major &lt;= 2 or (
major == 3 and (minor == 6 or (minor == 7 and patch == &#34;0&#34;))
):
if major &lt;= 2 or (major == 3 and (minor == 6 or (minor == 7 and patch == &#34;0&#34;))):
print_warning(
&#34;We highly recommend upgrading aiohttp to 3.7.3 or higher versions.&#34;
&#34;An older version of the library may not work with the Slack server-side in the future.&#34;
Expand Down
22 changes: 6 additions & 16 deletions docs/api-docs/slack_sdk/audit_logs/async_client.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,9 @@ <h2 id="args">Args</h2>
self.trust_env_in_session = trust_env_in_session
self.auth = auth
self.default_headers = default_headers if default_headers else {}
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(
user_agent_prefix, user_agent_suffix
)
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(user_agent_prefix, user_agent_suffix)
self.logger = logger if logger is not None else logging.getLogger(__name__)
self.retry_handlers = (
retry_handlers if retry_handlers is not None else async_default_handlers()
)
self.retry_handlers = retry_handlers if retry_handlers is not None else async_default_handlers()

if self.proxy is None or len(self.proxy.strip()) == 0:
env_variable = load_http_proxy_from_env(self.logger)
Expand Down Expand Up @@ -327,8 +323,7 @@ <h2 id="args">Args</h2>

if self.logger.level &lt;= logging.DEBUG:
headers_for_logging = {
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v
for k, v in headers.items()
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v for k, v in headers.items()
}
self.logger.debug(
f&#34;Sending a request - &#34;
Expand All @@ -345,14 +340,10 @@ <h2 id="args">Args</h2>
retry_response = RetryHttpResponse(
status_code=res.status,
headers=res.headers,
data=response_body.encode(&#34;utf-8&#34;)
if response_body is not None
else None,
data=response_body.encode(&#34;utf-8&#34;) if response_body is not None else None,
)
except aiohttp.ContentTypeError:
self.logger.debug(
f&#34;No response data returned from the following API call: {url}.&#34;
)
self.logger.debug(f&#34;No response data returned from the following API call: {url}.&#34;)
except json.decoder.JSONDecodeError as e:
message = f&#34;Failed to parse the response body: {str(e)}&#34;
raise SlackApiError(message, res)
Expand Down Expand Up @@ -397,8 +388,7 @@ <h2 id="args">Args</h2>
):
if self.logger.level &lt;= logging.DEBUG:
self.logger.info(
f&#34;A retry handler found: {type(handler).__name__} &#34;
f&#34;for {http_verb} {url} - {e}&#34;
f&#34;A retry handler found: {type(handler).__name__} &#34; f&#34;for {http_verb} {url} - {e}&#34;
)
await handler.prepare_for_next_attempt_async(
state=retry_state,
Expand Down
57 changes: 13 additions & 44 deletions docs/api-docs/slack_sdk/audit_logs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,9 @@ <h2 id="args">Args</h2>
self.proxy = proxy
self.base_url = base_url
self.default_headers = default_headers if default_headers else {}
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(
user_agent_prefix, user_agent_suffix
)
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(user_agent_prefix, user_agent_suffix)
self.logger = logger if logger is not None else logging.getLogger(__name__)
self.retry_handlers = (
retry_handlers if retry_handlers is not None else default_retry_handlers()
)
self.retry_handlers = retry_handlers if retry_handlers is not None else default_retry_handlers()

if self.proxy is None or len(self.proxy.strip()) == 0:
env_variable = load_http_proxy_from_env(self.logger)
Expand Down Expand Up @@ -293,13 +289,8 @@ <h2 id="args">Args</h2>
headers[&#34;Content-Type&#34;] = &#34;application/json;charset=utf-8&#34;

if self.logger.level &lt;= logging.DEBUG:
headers_for_logging = {
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v
for k, v in headers.items()
}
self.logger.debug(
f&#34;Sending a request - url: {url}, body: {body}, headers: {headers_for_logging}&#34;
)
headers_for_logging = {k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v for k, v in headers.items()}
self.logger.debug(f&#34;Sending a request - url: {url}, body: {body}, headers: {headers_for_logging}&#34;)

# NOTE: Intentionally ignore the `http_verb` here
# Slack APIs accepts any API method requests with POST methods
Expand Down Expand Up @@ -338,15 +329,9 @@ <h2 id="args">Args</h2>
)
if e.code == 429:
# for backward-compatibility with WebClient (v.2.5.0 or older)
if (
&#34;retry-after&#34; not in resp.headers
and &#34;Retry-After&#34; in resp.headers
):
if &#34;retry-after&#34; not in resp.headers and &#34;Retry-After&#34; in resp.headers:
resp.headers[&#34;retry-after&#34;] = resp.headers[&#34;Retry-After&#34;]
if (
&#34;Retry-After&#34; not in resp.headers
and &#34;retry-after&#34; in resp.headers
):
if &#34;Retry-After&#34; not in resp.headers and &#34;retry-after&#34; in resp.headers:
resp.headers[&#34;Retry-After&#34;] = resp.headers[&#34;retry-after&#34;]
_debug_log_response(self.logger, resp)

Expand All @@ -355,9 +340,7 @@ <h2 id="args">Args</h2>
retry_response = RetryHttpResponse(
status_code=e.code,
headers={k: [v] for k, v in e.headers.items()},
data=response_body.encode(&#34;utf-8&#34;)
if response_body is not None
else None,
data=response_body.encode(&#34;utf-8&#34;) if response_body is not None else None,
)
for handler in self.retry_handlers:
if handler.can_retry(
Expand All @@ -383,9 +366,7 @@ <h2 id="args">Args</h2>

except Exception as err:
last_error = err
self.logger.error(
f&#34;Failed to send a request to Slack API server: {err}&#34;
)
self.logger.error(f&#34;Failed to send a request to Slack API server: {err}&#34;)

# Try to find a retry handler for this error
retry_request = RetryHttpRequest.from_urllib_http_request(req)
Expand All @@ -406,9 +387,7 @@ <h2 id="args">Args</h2>
response=None,
error=err,
)
self.logger.info(
f&#34;Going to retry the same request: {req.method} {req.full_url}&#34;
)
self.logger.info(f&#34;Going to retry the same request: {req.method} {req.full_url}&#34;)
break

if retry_state.next_attempt_requested is False:
Expand All @@ -418,9 +397,7 @@ <h2 id="args">Args</h2>
return resp
raise last_error

def _perform_http_request_internal(
self, url: str, req: Request
) -&gt; AuditLogsResponse:
def _perform_http_request_internal(self, url: str, req: Request) -&gt; AuditLogsResponse:
opener: Optional[OpenerDirector] = None
# for security (BAN-B310)
if url.lower().startswith(&#34;http&#34;):
Expand All @@ -431,9 +408,7 @@ <h2 id="args">Args</h2>
HTTPSHandler(context=self.ssl),
)
else:
raise SlackRequestError(
f&#34;Invalid proxy detected: {self.proxy} must be a str value&#34;
)
raise SlackRequestError(f&#34;Invalid proxy detected: {self.proxy} must be a str value&#34;)
else:
raise SlackRequestError(f&#34;Invalid URL detected: {url}&#34;)

Expand All @@ -442,9 +417,7 @@ <h2 id="args">Args</h2>
if opener:
http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310
else:
http_resp = urlopen( # skipcq: BAN-B310
req, context=self.ssl, timeout=self.timeout
)
http_resp = urlopen(req, context=self.ssl, timeout=self.timeout) # skipcq: BAN-B310
charset: str = http_resp.headers.get_content_charset() or &#34;utf-8&#34;
response_body: str = http_resp.read().decode(charset)
resp = AuditLogsResponse(
Expand Down Expand Up @@ -753,11 +726,7 @@ <h2 id="returns">Returns</h2>
self.status_code = status_code
self.headers = headers
self.raw_body = raw_body
self.body = (
json.loads(raw_body)
if raw_body is not None and raw_body.startswith(&#34;{&#34;)
else None
)</code></pre>
self.body = json.loads(raw_body) if raw_body is not None and raw_body.startswith(&#34;{&#34;) else None</code></pre>
</details>
<h3>Class variables</h3>
<dl>
Expand Down
44 changes: 12 additions & 32 deletions docs/api-docs/slack_sdk/audit_logs/v1/async_client.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,9 @@ <h1 class="title">Module <code>slack_sdk.audit_logs.v1.async_client</code></h1>
self.trust_env_in_session = trust_env_in_session
self.auth = auth
self.default_headers = default_headers if default_headers else {}
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(
user_agent_prefix, user_agent_suffix
)
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(user_agent_prefix, user_agent_suffix)
self.logger = logger if logger is not None else logging.getLogger(__name__)
self.retry_handlers = (
retry_handlers if retry_handlers is not None else async_default_handlers()
)
self.retry_handlers = retry_handlers if retry_handlers is not None else async_default_handlers()

if self.proxy is None or len(self.proxy.strip()) == 0:
env_variable = load_http_proxy_from_env(self.logger)
Expand Down Expand Up @@ -301,8 +297,7 @@ <h1 class="title">Module <code>slack_sdk.audit_logs.v1.async_client</code></h1>

if self.logger.level &lt;= logging.DEBUG:
headers_for_logging = {
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v
for k, v in headers.items()
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v for k, v in headers.items()
}
self.logger.debug(
f&#34;Sending a request - &#34;
Expand All @@ -319,14 +314,10 @@ <h1 class="title">Module <code>slack_sdk.audit_logs.v1.async_client</code></h1>
retry_response = RetryHttpResponse(
status_code=res.status,
headers=res.headers,
data=response_body.encode(&#34;utf-8&#34;)
if response_body is not None
else None,
data=response_body.encode(&#34;utf-8&#34;) if response_body is not None else None,
)
except aiohttp.ContentTypeError:
self.logger.debug(
f&#34;No response data returned from the following API call: {url}.&#34;
)
self.logger.debug(f&#34;No response data returned from the following API call: {url}.&#34;)
except json.decoder.JSONDecodeError as e:
message = f&#34;Failed to parse the response body: {str(e)}&#34;
raise SlackApiError(message, res)
Expand Down Expand Up @@ -371,8 +362,7 @@ <h1 class="title">Module <code>slack_sdk.audit_logs.v1.async_client</code></h1>
):
if self.logger.level &lt;= logging.DEBUG:
self.logger.info(
f&#34;A retry handler found: {type(handler).__name__} &#34;
f&#34;for {http_verb} {url} - {e}&#34;
f&#34;A retry handler found: {type(handler).__name__} &#34; f&#34;for {http_verb} {url} - {e}&#34;
)
await handler.prepare_for_next_attempt_async(
state=retry_state,
Expand Down Expand Up @@ -503,13 +493,9 @@ <h2 id="args">Args</h2>
self.trust_env_in_session = trust_env_in_session
self.auth = auth
self.default_headers = default_headers if default_headers else {}
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(
user_agent_prefix, user_agent_suffix
)
self.default_headers[&#34;User-Agent&#34;] = get_user_agent(user_agent_prefix, user_agent_suffix)
self.logger = logger if logger is not None else logging.getLogger(__name__)
self.retry_handlers = (
retry_handlers if retry_handlers is not None else async_default_handlers()
)
self.retry_handlers = retry_handlers if retry_handlers is not None else async_default_handlers()

if self.proxy is None or len(self.proxy.strip()) == 0:
env_variable = load_http_proxy_from_env(self.logger)
Expand Down Expand Up @@ -690,8 +676,7 @@ <h2 id="args">Args</h2>

if self.logger.level &lt;= logging.DEBUG:
headers_for_logging = {
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v
for k, v in headers.items()
k: &#34;(redacted)&#34; if k.lower() == &#34;authorization&#34; else v for k, v in headers.items()
}
self.logger.debug(
f&#34;Sending a request - &#34;
Expand All @@ -708,14 +693,10 @@ <h2 id="args">Args</h2>
retry_response = RetryHttpResponse(
status_code=res.status,
headers=res.headers,
data=response_body.encode(&#34;utf-8&#34;)
if response_body is not None
else None,
data=response_body.encode(&#34;utf-8&#34;) if response_body is not None else None,
)
except aiohttp.ContentTypeError:
self.logger.debug(
f&#34;No response data returned from the following API call: {url}.&#34;
)
self.logger.debug(f&#34;No response data returned from the following API call: {url}.&#34;)
except json.decoder.JSONDecodeError as e:
message = f&#34;Failed to parse the response body: {str(e)}&#34;
raise SlackApiError(message, res)
Expand Down Expand Up @@ -760,8 +741,7 @@ <h2 id="args">Args</h2>
):
if self.logger.level &lt;= logging.DEBUG:
self.logger.info(
f&#34;A retry handler found: {type(handler).__name__} &#34;
f&#34;for {http_verb} {url} - {e}&#34;
f&#34;A retry handler found: {type(handler).__name__} &#34; f&#34;for {http_verb} {url} - {e}&#34;
)
await handler.prepare_for_next_attempt_async(
state=retry_state,
Expand Down
Loading

0 comments on commit ddffefc

Please sign in to comment.