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