HTTP request authority. For HTTP/1, this is the authority portion of the request target (in either absolute-form or authority-form). For origin-form and asterisk-form requests, this property is set to an empty string. For HTTP/2, this is the :authority pseu
(self)
| 678 | |
| 679 | @property |
| 680 | def authority(self) -> str: |
| 681 | """ |
| 682 | HTTP request authority. |
| 683 | |
| 684 | For HTTP/1, this is the authority portion of the request target |
| 685 | (in either absolute-form or authority-form). |
| 686 | For origin-form and asterisk-form requests, this property is set to an empty string. |
| 687 | |
| 688 | For HTTP/2, this is the :authority pseudo header. |
| 689 | |
| 690 | *See also:* `Request.host`, `Request.host_header`, `Request.pretty_host` |
| 691 | """ |
| 692 | try: |
| 693 | return self.data.authority.decode("idna") |
| 694 | except UnicodeError: |
| 695 | return self.data.authority.decode("utf8", "surrogateescape") |
| 696 | |
| 697 | @authority.setter |
| 698 | def authority(self, val: str | bytes) -> None: |