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 <manu+github@lacavernedemanu.fr>
This commit is contained in:
Unam LN 2020-12-23 01:34:32 +01:00 committed by GitHub
parent 59a0a912a8
commit 984d9151d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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