Use domain_to_idna in get_file_by_url
authorAlexander Cecile <redacted>
Thu, 20 Aug 2020 20:15:37 +0000 (16:15 -0400)
committerAlexander Cecile <redacted>
Thu, 20 Aug 2020 20:15:37 +0000 (16:15 -0400)
updateHostsFile.py

index b8d64a29cf5c592e5666d7b2efc6eb14242b7aec..ad31a246ba896c98092fd7978e8f863f71694e90 100644 (file)
@@ -1466,10 +1466,11 @@ def maybe_copy_example_file(file_path):
             shutil.copyfile(example_file_path, file_path)
 
 
-def get_file_by_url(url, params, **kwargs):
+def get_file_by_url(url, params=None, **kwargs):
     req = requests.get(url=url, params=params, **kwargs)
     req.encoding = req.apparent_encoding
-    return req.text
+    res_text = "\n".join([domain_to_idna(line) for line in req.text.splitlines()])
+    return res_text
 
 
 def write_data(f, data):
git clone https://git.99rst.org/PROJECT