Returns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified.
(self, name, default=None)
| 751 | return self.fp.fileno() |
| 752 | |
| 753 | def getheader(self, name, default=None): |
| 754 | '''Returns the value of the header matching *name*. |
| 755 | |
| 756 | If there are multiple matching headers, the values are |
| 757 | combined into a single string separated by commas and spaces. |
| 758 | |
| 759 | If no matching header is found, returns *default* or None if |
| 760 | the *default* is not specified. |
| 761 | |
| 762 | If the headers are unknown, raises http.client.ResponseNotReady. |
| 763 | |
| 764 | ''' |
| 765 | if self.headers is None: |
| 766 | raise ResponseNotReady() |
| 767 | headers = self.headers.get_all(name) or default |
| 768 | if isinstance(headers, str) or not hasattr(headers, '__iter__'): |
| 769 | return headers |
| 770 | else: |
| 771 | return ', '.join(headers) |
| 772 | |
| 773 | def getheaders(self): |
| 774 | """Return list of (header, value) tuples.""" |