diff options
author | Leonard Richardson <leonardr@segfault.org> | 2021-12-21 15:53:21 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2021-12-21 15:53:21 -0500 |
commit | 2906d69e91f12fc2cd632efb534636cc7847e860 (patch) | |
tree | 3f9a4680ea1e9a548e27ddfcd7e8895bd651c741 | |
parent | 4504e4fba31927ec3e5a5d9b3960ffd8efb2b798 (diff) |
Standardized the wording of the MarkupResemblesLocatorWarning
warnings to to make them less judgemental about what you ought to
be doing. [bug=1955450]
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | bs4/__init__.py | 15 |
2 files changed, 12 insertions, 7 deletions
@@ -49,6 +49,10 @@ Python 2 was revision 605. * Fixed a crash when overriding multi_valued_attributes and using the html5lib parser. [bug=1948488] +* Changed the wording of the MarkupResemblesLocatorWarning + warnings to to make them less judgemental about what you ought to + be doing. [bug=1955450] + * Removed support for the iconv_codec library, which doesn't seem to exist anymore and was never put up on PyPI. (The closest replacement on PyPI, iconv_codecs, is GPL-licensed, so we can't use diff --git a/bs4/__init__.py b/bs4/__init__.py index 75c801c..2371ccf 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -346,8 +346,8 @@ class BeautifulSoup(Tag): ) elif is_file: warnings.warn( - '"%s" looks like a filename, not markup. You should' - ' probably open this file and pass the filehandle into' + '"%s" looks like a filename, not markup. You may' + ' want to open this file and pass the filehandle into' ' Beautiful Soup.' % self._decode_markup(markup), MarkupResemblesLocatorWarning ) @@ -432,11 +432,12 @@ class BeautifulSoup(Tag): if any(markup.startswith(prefix) for prefix in cant_start_with): if not space in markup: warnings.warn( - '"%s" looks like a URL. Beautiful Soup is not an' - ' HTTP client. You should probably use an HTTP client like' - ' requests to get the document behind the URL, and feed' - ' that document to Beautiful Soup.' % cls._decode_markup( - markup + '"%s" looks like a URL, not markup. You may want to use' + ' an HTTP client like requests to get the document behind' + ' the URL, and feed that document to Beautiful Soup.' % ( + cls._decode_markup( + markup + ) ), MarkupResemblesLocatorWarning ) |