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)
| 116 | return self |
| 117 | |
| 118 | def __next__(self): |
| 119 | """Retrieves the next portion of results, if 'next_cursor' is present. |
| 120 | |
| 121 | Note: |
| 122 | Some responses return collections of information |
| 123 | like channel and user lists. If they do it's likely |
| 124 | that you'll only receive a portion of results. This |
| 125 | method allows you to iterate over the response until |
| 126 | your code hits 'break' or there are no more results |
| 127 | to be found. |
| 128 | |
| 129 | Returns: |
| 130 | (SlackResponse) self |
| 131 | With the new response data now attached to this object. |
| 132 | |
| 133 | Raises: |
| 134 | SlackApiError: If the request to the Slack API failed. |
| 135 | StopIteration: If 'next_cursor' is not present or empty. |
| 136 | """ |
| 137 | if isinstance(self.data, bytes): |
| 138 | raise ValueError("As the response.data is binary data, this operation is unsupported") |
| 139 | self._iteration += 1 |
| 140 | if self._iteration == 1: |
| 141 | return self |
| 142 | if _next_cursor_is_present(self.data): |
| 143 | params = self.req_args.get("params", {}) |
| 144 | if params is None: |
| 145 | params = {} |
| 146 | next_cursor = self.data.get("response_metadata", {}).get("next_cursor") or self.data.get("next_cursor") |
| 147 | params.update({"cursor": next_cursor}) |
| 148 | self.req_args.update({"params": params}) |
| 149 | |
| 150 | # This method sends a request in a synchronous way |
| 151 | response = self._client._request_for_pagination(api_url=self.api_url, req_args=self.req_args) |
| 152 | self.data = response["data"] |
| 153 | self.headers = response["headers"] |
| 154 | self.status_code = response["status_code"] |
| 155 | return self.validate() |
| 156 | else: |
| 157 | raise StopIteration |
| 158 | |
| 159 | @overload |
| 160 | def get(self, key: str, default: None = None) -> Optional[Any]: ... |
nothing calls this directly
no test coverage detected