mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
preview: Use a dataclass for the embed data.
This is significantly cleaner than passing around `Dict[str, Any]` all
of the time.
(cherry picked from commit 327ff9ea0f)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import cgi
|
||||
from typing import Any, Optional
|
||||
from typing import Optional
|
||||
|
||||
from zerver.lib.url_preview.types import UrlEmbedData
|
||||
|
||||
|
||||
class BaseParser:
|
||||
@@ -14,5 +16,5 @@ class BaseParser:
|
||||
charset = cgi.parse_header(content_type)[1].get("charset")
|
||||
self._soup = BeautifulSoup(html_source, "lxml", from_encoding=charset)
|
||||
|
||||
def extract_data(self) -> Any:
|
||||
def extract_data(self) -> UrlEmbedData:
|
||||
raise NotImplementedError()
|
||||
|
||||
Reference in New Issue
Block a user