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)
| 724 | return self.fp.fileno() |
| 725 | |
| 726 | def getheader(self, name, default=None): |
| 727 | '''Returns the value of the header matching *name*. |
| 728 | |
| 729 | If there are multiple matching headers, the values are |
| 730 | combined into a single string separated by commas and spaces. |
| 731 | |
| 732 | If no matching header is found, returns *default* or None if |
| 733 | the *default* is not specified. |
| 734 | |
| 735 | If the headers are unknown, raises http.client.ResponseNotReady. |
| 736 | |
| 737 | ''' |
| 738 | if self.headers is None: |
| 739 | raise ResponseNotReady() |
| 740 | headers = self.headers.get_all(name) or default |
| 741 | if isinstance(headers, str) or not hasattr(headers, '__iter__'): |
| 742 | return headers |
| 743 | else: |
| 744 | return ', '.join(headers) |
| 745 | |
| 746 | def getheaders(self): |
| 747 | """Return list of (header, value) tuples.""" |
no test coverage detected