slack.io.abc
- Abstract Base Class¶
-
class
slack.io.abc.
SlackAPI
(*, token: str, headers: Optional[MutableMapping[KT, VT]] = None)[source]¶ abstract base class abstracting the HTTP library used to call Slack API. Built with the functions of
slack.sansio
.Parameters: - session – HTTP session
- token – Slack API token
- headers – Default headers for all request
-
async-for
iter
(url: Union[str, slack.methods.Methods], data: Optional[MutableMapping[KT, VT]] = None, headers: Optional[MutableMapping[KT, VT]] = None, *, limit: int = 200, iterkey: Optional[str] = None, itermode: Optional[str] = None, minimum_time: Optional[int] = None, as_json: Optional[bool] = None) → AsyncIterator[dict][source]¶ Iterate over a slack API method supporting pagination
When using
slack.methods
the request is made as_json if availableParameters: - url –
slack.methods
or url string - data – JSON encodable MutableMapping
- headers –
- limit – Maximum number of results to return per call.
- iterkey – Key in response data to iterate over (required for url string).
- itermode – Iteration mode (required for url string) (one of cursor, page or timeline)
- minimum_time – Minimum elapsed time (in seconds) between two calls to the Slack API (default to 0). If not reached the client will sleep for the remaining time.
- as_json – Post JSON to the slack API
Returns: Async iterator over response_data[key]
- url –
-
async-for
rtm
(url: Optional[str] = None, bot_id: Optional[str] = None) → AsyncIterator[slack.events.Event][source]¶ Iterate over event from the RTM API
Parameters: - url – Websocket connection url
- bot_id – Connecting bot ID
Returns:
-
coroutine
query
(url: Union[str, slack.methods.Methods], data: Optional[MutableMapping[KT, VT]] = None, headers: Optional[MutableMapping[KT, VT]] = None, as_json: Optional[bool] = None) → dict[source]¶ Query the slack API
When using
slack.methods
the request is made as_json if availableParameters: - url –
slack.methods
or url string - data – JSON encodable MutableMapping
- headers – Custom headers
- as_json – Post JSON to the slack API
Returns: dictionary of slack API response data
- url –