Update error handling in get_file_by_url
authorAlexander Cecile <redacted>
Wed, 26 Aug 2020 00:48:35 +0000 (20:48 -0400)
committerAlexander Cecile <redacted>
Wed, 26 Aug 2020 00:48:35 +0000 (20:48 -0400)
I don't believe the the .text could actually raise that exception. Oops.

updateHostsFile.py

index 2a4bce297127adc6a5184ea800805f9c204a75bc..60fd80d7a2a9d697f7e22ed835f4ae8eb52770c2 100644 (file)
@@ -1495,16 +1495,8 @@ def get_file_by_url(url, params=None, **kwargs):
         return None
 
     req.encoding = req.apparent_encoding
-
-    try:
-        res_text = req.text
-    except UnicodeDecodeError:
-        print("Decoding error when retrieving data from {}".format(url))
-        return None
-
-    res = "\n".join([domain_to_idna(line) for line in res_text.split("\n")])
-
-    return res
+    res_text = "\n".join([domain_to_idna(line) for line in req.text.split("\n")])
+    return res_text
 
 
 def write_data(f, data):
git clone https://git.99rst.org/PROJECT