Get a header value. Return None if the header is missing instead of raising an exception. Note that if the header appeared multiple times, exactly which occurrence gets returned is undefined. Use get_all() to get all the values matching a header field name.
(self, name)
| 420 | return len(self._headers) |
| 421 | |
| 422 | def __getitem__(self, name): |
| 423 | """Get a header value. |
| 424 | |
| 425 | Return None if the header is missing instead of raising an exception. |
| 426 | |
| 427 | Note that if the header appeared multiple times, exactly which |
| 428 | occurrence gets returned is undefined. Use get_all() to get all |
| 429 | the values matching a header field name. |
| 430 | """ |
| 431 | return self.get(name) |
| 432 | |
| 433 | def __setitem__(self, name, val): |
| 434 | """Set the value of a header. |