Return a list of all header values for a given key. If `split_commas=True` is passed, then any comma separated header values are split into multiple return strings.
(self, key: str, split_commas: bool = False)
| 250 | return default |
| 251 | |
| 252 | def get_list(self, key: str, split_commas: bool = False) -> list[str]: |
| 253 | class="st">""" |
| 254 | Return a list of all header values for a given key. |
| 255 | If `split_commas=True` is passed, then any comma separated header |
| 256 | values are split into multiple return strings. |
| 257 | class="st">""" |
| 258 | get_header_key = key.lower().encode(self.encoding) |
| 259 | |
| 260 | values = [ |
| 261 | item_value.decode(self.encoding) |
| 262 | for _, item_key, item_value in self._list |
| 263 | if item_key.lower() == get_header_key |
| 264 | ] |
| 265 | |
| 266 | if not split_commas: |
| 267 | return values |
| 268 | |
| 269 | split_values = [] |
| 270 | for value in values: |
| 271 | split_values.extend([item.strip() for item in value.split(class="st">",")]) |
| 272 | return split_values |
| 273 | |
| 274 | def update(self, headers: HeaderTypes | None = None) -> None: class="cm"># type: ignore |
| 275 | headers = Headers(headers) |