Retrieves any key from the data store. Note: This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response["ok"] Returns: The value from data or None.
(self, key)
| 82 | return self.get(key) is not None |
| 83 | |
| 84 | def __getitem__(self, key): |
| 85 | """Retrieves any key from the data store. |
| 86 | |
| 87 | Note: |
| 88 | This is implemented so users can reference the |
| 89 | SlackResponse object like a dictionary. |
| 90 | e.g. response["ok"] |
| 91 | |
| 92 | Returns: |
| 93 | The value from data or None. |
| 94 | """ |
| 95 | if isinstance(self.data, bytes): |
| 96 | raise ValueError("As the response.data is binary data, this operation is unsupported") |
| 97 | if self.data is None: |
| 98 | raise ValueError("As the response.data is empty, this operation is unsupported") |
| 99 | return self.data.get(key, None) |
| 100 | |
| 101 | def __aiter__(self): |
| 102 | """Enables the ability to iterate over the response. |