support for content compression

'Accept-Encoding': 'gzip, deflate'
This commit is contained in:
Jylpah committed 2020-05-16 02:45:49 +03:00
1 parent 398c0c4113
commit 01e01f3077
1 file changed
+6 -4
+6 -4
View File
@@ -116,11 +116,12 @@ class ThrottledClientSession(aiohttp.ClientSession):
await self._allow()
return await super()._request(*args,**kwargs)
## -----------------------------------------------------------
#### Utils
## -----------------------------------------------------------
def set_debug(debug: bool):
global _log_level
_log_level = DEBUG
@@ -588,7 +589,8 @@ class WG:
verbose('Could not find maps file: ' + maps_fn)
self.rate_limiter = None
if self.WG_app_id != None:
self.session = ThrottledClientSession(rate_limit=rate_limit)
headers = {'Accept-Encoding': 'gzip, deflate'}
self.session = ThrottledClientSession(rate_limit=rate_limit, headers=headers)
debug('WG aiohttp session initiated')
else:
self.session = None
@@ -1370,8 +1372,8 @@ class BlitzStars:
def __init__(self, rate_limit=30):
self.session = ThrottledClientSession(rate_limit=rate_limit)
headers = {'Accept-Encoding': 'gzip, deflate'}
self.session = ThrottledClientSession(rate_limit=rate_limit, headers=headers)
async def close(self):
if self.session != None: