Retrieves the next portion of results, if 'next_cursor' is present. Note: Some responses return collections of information like channel and user lists. If they do it's likely that you'll only receive a portion of results. This method allows yo
(self)
| 113 | return self |
| 114 | |
| 115 | async def __anext__(self): |
| 116 | """Retrieves the next portion of results, if 'next_cursor' is present. |
| 117 | |
| 118 | Note: |
| 119 | Some responses return collections of information |
| 120 | like channel and user lists. If they do it's likely |
| 121 | that you'll only receive a portion of results. This |
| 122 | method allows you to iterate over the response until |
| 123 | your code hits 'break' or there are no more results |
| 124 | to be found. |
| 125 | |
| 126 | Returns: |
| 127 | (AsyncSlackResponse) self |
| 128 | With the new response data now attached to this object. |
| 129 | |
| 130 | Raises: |
| 131 | SlackApiError: If the request to the Slack API failed. |
| 132 | StopAsyncIteration: If 'next_cursor' is not present or empty. |
| 133 | """ |
| 134 | self._iteration += 1 |
| 135 | if self._iteration == 1: |
| 136 | return self |
| 137 | if _next_cursor_is_present(self.data): # skipcq: PYL-R1705 |
| 138 | params = self.req_args.get("params", {}) |
| 139 | if params is None: |
| 140 | params = {} |
| 141 | params.update({"cursor": self.data["response_metadata"]["next_cursor"]}) |
| 142 | self.req_args.update({"params": params}) |
| 143 | |
| 144 | response = await self._client._request( # skipcq: PYL-W0212 |
| 145 | http_verb=self.http_verb, |
| 146 | api_url=self.api_url, |
| 147 | req_args=self.req_args, |
| 148 | ) |
| 149 | |
| 150 | self.data = response["data"] |
| 151 | self.headers = response["headers"] |
| 152 | self.status_code = response["status_code"] |
| 153 | return self.validate() |
| 154 | else: |
| 155 | raise StopAsyncIteration |
| 156 | |
| 157 | def get(self, key, default=None): |
| 158 | """Retrieves any key from the response data. |
nothing calls this directly
no test coverage detected