[common] new parameters for getHttps

This commit is contained in:
Mort Yao 2022-05-15 22:50:09 +02:00
parent 0842913abf
commit c768b29153
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -344,7 +344,7 @@ def undeflate(data):
# an http.client implementation of get_content()
# because urllib does not support "Connection: keep-alive"
def getHttps(host, url, headers, debuglevel=0):
def getHttps(host, url, headers, gzip=True, deflate=False, debuglevel=0):
import http.client
conn = http.client.HTTPSConnection(host)
@ -353,8 +353,10 @@ def getHttps(host, url, headers, debuglevel=0):
resp = conn.getresponse()
data = resp.read()
if gzip:
data = ungzip(data)
#data = undeflate(data)
if deflate:
data = undeflate(data)
return str(data, encoding='utf-8')