1
0
Fork 0

avoid BeautifulSoup warning output since v4.9.3 ()

https://stackoverflow.com/questions/36039724/suppress-warning-of-url-in-beautifulsoup/78445796#78445796
This commit is contained in:
n 2025-03-20 23:44:22 +01:00
parent 4a3e3664ad
commit 324e90e1e4
Signed by: n
GPG key ID: 510227DD6C502CE3

View file

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