MCPcopy Index your code
hub / github.com/slackapi/python-slack-sdk / __getitem__

Method __getitem__

slack/web/async_slack_response.py:84–99  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected