Retrieves any key from the response data. Note: This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response.get("ok", False) Returns: The value from data or the specified default.
(self, key, default=None)
| 155 | raise StopAsyncIteration |
| 156 | |
| 157 | def get(self, key, default=None): |
| 158 | """Retrieves any key from the response data. |
| 159 | |
| 160 | Note: |
| 161 | This is implemented so users can reference the |
| 162 | SlackResponse object like a dictionary. |
| 163 | e.g. response.get("ok", False) |
| 164 | |
| 165 | Returns: |
| 166 | The value from data or the specified default. |
| 167 | """ |
| 168 | if isinstance(self.data, bytes): |
| 169 | raise ValueError("As the response.data is binary data, this operation is unsupported") |
| 170 | if self.data is None: |
| 171 | return None |
| 172 | return self.data.get(key, default) |
| 173 | |
| 174 | def validate(self): |
| 175 | """Check if the response from Slack was successful. |
no outgoing calls