Extend headers in this object with items from another object containing header items as well as keyword arguments. To replace existing keys instead of extending, use :meth:`update` instead. If provided, the first argument can be another :class:`Headers` obje
(
self,
arg: (
Headers
| MultiDict[str, t.Any]
| cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]]
| cabc.Iterable[tuple[str, t.Any]]
| None
) = None,
/,
**kwargs: str,
)
| 223 | yield value |
| 224 | |
| 225 | def extend( |
| 226 | self, |
| 227 | arg: ( |
| 228 | Headers |
| 229 | | MultiDict[str, t.Any] |
| 230 | | cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]] |
| 231 | | cabc.Iterable[tuple[str, t.Any]] |
| 232 | | None |
| 233 | ) = None, |
| 234 | /, |
| 235 | **kwargs: str, |
| 236 | ) -> None: |
| 237 | """Extend headers in this object with items from another object |
| 238 | containing header items as well as keyword arguments. |
| 239 | |
| 240 | To replace existing keys instead of extending, use |
| 241 | :meth:`update` instead. |
| 242 | |
| 243 | If provided, the first argument can be another :class:`Headers` |
| 244 | object, a :class:`MultiDict`, :class:`dict`, or iterable of |
| 245 | pairs. |
| 246 | |
| 247 | .. versionchanged:: 1.0 |
| 248 | Support :class:`MultiDict`. Allow passing ``kwargs``. |
| 249 | """ |
| 250 | if arg is not None: |
| 251 | for key, value in iter_multi_items(arg): |
| 252 | self.add(key, value) |
| 253 | |
| 254 | for key, value in iter_multi_items(kwargs): |
| 255 | self.add(key, value) |
| 256 | |
| 257 | def __delitem__(self, key: str | int | slice) -> None: |
| 258 | if isinstance(key, str): |