git.99rst.org
/
stevenblack-hosts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
5186071
)
Tell requests to detect encoding.
author
Alexander Cecile
<redacted>
Tue, 18 Aug 2020 23:36:47 +0000
(19:36 -0400)
committer
Alexander Cecile
<redacted>
Tue, 18 Aug 2020 23:36:47 +0000
(19:36 -0400)
Changed the get_file_by_url function to infer/guess the encoding of the content we receive.
updateHostsFile.py
patch
|
blob
|
history
diff --git
a/updateHostsFile.py
b/updateHostsFile.py
index 3e2b001852c9c27f96dfcc7941f822b05d07f850..b8d64a29cf5c592e5666d7b2efc6eb14242b7aec 100644
(file)
--- a/
updateHostsFile.py
+++ b/
updateHostsFile.py
@@
-1467,7
+1467,9
@@
def maybe_copy_example_file(file_path):
def get_file_by_url(url, params, **kwargs):
- return requests.get(url=url, params=params, **kwargs).text
+ req = requests.get(url=url, params=params, **kwargs)
+ req.encoding = req.apparent_encoding
+ return req.text
def write_data(f, data):
git clone https://git.99rst.org/PROJECT