I'm using Beautiful Soup 4 to parse some html-formatted text, scraped from the Internet. Sometimes this text is simply the link to some website. A fact that BS4 is very cross about:
UserWarning: "http://example.com" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client to get the document behind the URL, and feed that document to Beautiful Soup.
I'm very aware of this fact, I just want to interpret the text input, not get a lecture. I use the console for monitoring the activities of the script, and it's being cluttered by a very angry library.
Any way to suppress or disable this warning?
To simply suppress the warning and continue with processing this works:
import warnings warnings.filterwarnings("ignore", category=UserWarning, module='bs4')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With