summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-02-15 21:35:24 -0500
committerLeonard Richardson <leonardr@segfault.org>2023-02-15 21:35:24 -0500
commit021d43058412aa84777bc0383fe997e81b06363f (patch)
tree792fc50e9e7faaeb3fa8052e517e5ab51f571e57
parente0bbee776ca241d908af36e4e5ce0d0b1bedceaf (diff)
Removed some error checking code from diagnose(), which is redundant with
similar (but more Pythonic) code in the BeautifulSoup constructor. [bug=2007344]
-rw-r--r--CHANGELOG4
-rw-r--r--bs4/diagnose.py15
2 files changed, 4 insertions, 15 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4960e1e..417b531 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -33,6 +33,10 @@ Python 2 was revision 70f546b1e689a70e2f103795efce6d261a3dadf7.
Soup now consistently propagates this fact by raising a
ParserRejectedMarkup error. [bug=2007343]
+* Removed some error checking code from diagnose(), which is redundant with
+ similar (but more Pythonic) code in the BeautifulSoup constructor.
+ [bug=2007344]
+
= 4.11.2 (20230131)
* Fixed test failures caused by nondeterministic behavior of
diff --git a/bs4/diagnose.py b/bs4/diagnose.py
index 3bf583f..e079772 100644
--- a/bs4/diagnose.py
+++ b/bs4/diagnose.py
@@ -59,21 +59,6 @@ def diagnose(data):
if hasattr(data, 'read'):
data = data.read()
- elif data.startswith("http:") or data.startswith("https:"):
- print(('"%s" looks like a URL. Beautiful Soup is not an HTTP client.' % data))
- print("You need to use some other library to get the document behind the URL, and feed that document to Beautiful Soup.")
- return
- else:
- try:
- if os.path.exists(data):
- print(('"%s" looks like a filename. Reading data from the file.' % data))
- with open(data) as fp:
- data = fp.read()
- except ValueError:
- # This can happen on some platforms when the 'filename' is
- # too long. Assume it's data and not a filename.
- pass
- print("")
for parser in basic_parsers:
print(("Trying to parse your markup with %s" % parser))