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:
parent
59a0a912a8
commit
984d9151d5
|
@ -111,6 +111,7 @@ def log_error_and_exit(error: str) -> None:
|
||||||
|
|
||||||
class MLStripper(HTMLParser):
|
class MLStripper(HTMLParser):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
super().__init__()
|
||||||
self.reset()
|
self.reset()
|
||||||
self.fed = [] # type: List[str]
|
self.fed = [] # type: List[str]
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ def strip_tags(html: str) -> str:
|
||||||
def compute_entry_hash(entry: Dict[str, Any]) -> str:
|
def compute_entry_hash(entry: Dict[str, Any]) -> str:
|
||||||
entry_time = entry.get("published", entry.get("updated"))
|
entry_time = entry.get("published", entry.get("updated"))
|
||||||
entry_id = entry.get("id", entry.get("link"))
|
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:
|
def unwrap_text(body: str) -> str:
|
||||||
# Replace \n by space if it is preceded and followed by a non-\n.
|
# Replace \n by space if it is preceded and followed by a non-\n.
|
||||||
|
|
Loading…
Reference in a new issue