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
@@ -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.
