Document get_file_by_url
authorAlexander Cecile <redacted>
Thu, 20 Aug 2020 21:01:11 +0000 (17:01 -0400)
committerAlexander Cecile <redacted>
Thu, 20 Aug 2020 21:01:11 +0000 (17:01 -0400)
updateHostsFile.py

index ad31a246ba896c98092fd7978e8f863f71694e90..81d1da8201dae67a96577e42200ca1050fc9c44a 100644 (file)
@@ -1467,6 +1467,21 @@ def maybe_copy_example_file(file_path):
 
 
 def get_file_by_url(url, params=None, **kwargs):
+    """
+    Retrieve the contents of the hosts file at a certain URL, then pass it through domain_to_idna().
+
+    Simple wrapper around the requests.get() function, uses the same parameters.
+
+    Parameters
+    ----------
+    url
+    params
+    kwargs
+
+    Returns
+    -------
+    content: str
+    """
     req = requests.get(url=url, params=params, **kwargs)
     req.encoding = req.apparent_encoding
     res_text = "\n".join([domain_to_idna(line) for line in req.text.splitlines()])
git clone https://git.99rst.org/PROJECT