def get_headers(self, as_dict: bool = False) -> Union[MetadataDict, MetadataTuple]: """Gets headers from the response. Args: as_dict (bool): dict type headers if as_dict is True. Otherwise, return tuple headers. Returns: dict or tuple: response headers. """ if as_dict: return tuple_to_dict(self._headers) return self._headers
def get_metadata(self, as_dict: bool = False ) -> Union[MetadataDict, MetadataTuple]: """Gets metadata from the request. Args: as_dict (bool): dict type metadata if as_dict is True. Otherwise, return tuple metadata. Returns: dict or tuple: request metadata. """ if as_dict: return tuple_to_dict(self._metadata) return self._metadata