From 176378563f87a6b283e598ce7abb7ec5125b25bb Mon Sep 17 00:00:00 2001 From: bmaz Date: Wed, 21 Feb 2024 18:50:56 +0100 Subject: [PATCH] Catching warnings within context manager --- minet/scrape/classes/named/europresse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/minet/scrape/classes/named/europresse.py b/minet/scrape/classes/named/europresse.py index 847a9dff2b..500ece9b3f 100644 --- a/minet/scrape/classes/named/europresse.py +++ b/minet/scrape/classes/named/europresse.py @@ -7,11 +7,11 @@ from .types import NamedScraper -warnings.filterwarnings("ignore", category=MarkupResemblesLocatorWarning) - def extract_content(content): - return BeautifulSoup(unescape(content), "html.parser").get_text().strip() + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=MarkupResemblesLocatorWarning) + return BeautifulSoup(unescape(content), "html.parser").get_text().strip() def extract_date(doc_id):