[Python] Suppress warning of url in beautifulsoup

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página