mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 05:24:23 +00:00
Mainly make the python code to make it javascript for nuxt to access.
Python is just used for testing stuff, as it is a fine lang to do so.
This commit is contained in:
parent
81012f5061
commit
5f78e8c58a
9 changed files with 71 additions and 2 deletions
|
@ -42,9 +42,11 @@ try:
|
|||
req = Request(url, headers=headers)
|
||||
response = urlopen(req)
|
||||
if response.info().get('Content-Encoding') == 'gzip':
|
||||
print("GZIP")
|
||||
gzip_file = gzip.GzipFile(fileobj=io.BytesIO(response.read()))
|
||||
html = gzip_file.read().decode('utf-8')
|
||||
else:
|
||||
print("Not GZIP")
|
||||
html = response.read().decode('utf-8')
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue