From 324e90e1e46efc56f6184e083fc766cbcb3eef76 Mon Sep 17 00:00:00 2001 From: n <n@tourmentine.com> Date: Thu, 20 Mar 2025 23:44:22 +0100 Subject: [PATCH] avoid BeautifulSoup warning output since v4.9.3 (#1) https://stackoverflow.com/questions/36039724/suppress-warning-of-url-in-beautifulsoup/78445796#78445796 --- feed2toot/message.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/feed2toot/message.py b/feed2toot/message.py index ef431d6..909917e 100644 --- a/feed2toot/message.py +++ b/feed2toot/message.py @@ -18,6 +18,11 @@ # standard libraires imports import logging +# avoid BeautifulSoup warning output since v4.9.3 +# https://stackoverflow.com/questions/36039724/suppress-warning-of-url-in-beautifulsoup/78445796#78445796 +import warnings +from bs4 import MarkupResemblesLocatorWarning + # external liraries imports from bs4 import BeautifulSoup @@ -26,6 +31,10 @@ from feed2toot.addtags import AddTags from feed2toot.removeduplicates import RemoveDuplicates from feed2toot.tootpost import TootPost +# avoid BeautifulSoup warning output since v4.9.3 +# https://stackoverflow.com/questions/36039724/suppress-warning-of-url-in-beautifulsoup/78445796#78445796 +warnings.filterwarnings("ignore", category=MarkupResemblesLocatorWarning) + def build_message(entrytosend, tweetformat, rss, tootmaxlen, notagsintoot): '''populate the rss dict with the new entry''' tweetwithnotag = tweetformat.format(**entrytosend)