From 984d9151d5d101e8bbfe2c60cc6434b88577217d Mon Sep 17 00:00:00 2001 From: Unam LN Date: Wed, 23 Dec 2020 01:34:32 +0100 Subject: [PATCH] bots: Fix RSS bot for Python 3.x support. - Call `super()` in the init method. - Change return hashlib.md5 syntax to encode properly for Python 3 Signed-off-by: Manu LN --- zulip/integrations/rss/rss-bot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zulip/integrations/rss/rss-bot b/zulip/integrations/rss/rss-bot index 27defd2..c387732 100755 --- a/zulip/integrations/rss/rss-bot +++ b/zulip/integrations/rss/rss-bot @@ -111,6 +111,7 @@ def log_error_and_exit(error: str) -> None: class MLStripper(HTMLParser): def __init__(self) -> None: + super().__init__() self.reset() self.fed = [] # type: List[str] @@ -128,7 +129,7 @@ def strip_tags(html: str) -> str: def compute_entry_hash(entry: Dict[str, Any]) -> str: entry_time = entry.get("published", entry.get("updated")) entry_id = entry.get("id", entry.get("link")) - return hashlib.md5(entry_id + str(entry_time)).hexdigest() + return hashlib.md5((entry_id + str(entry_time)).encode()).hexdigest() def unwrap_text(body: str) -> str: # Replace \n by space if it is preceded and followed by a non-\n.