mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-23 19:19:53 +02:00
support for content compression
'Accept-Encoding': 'gzip, deflate'
This commit is contained in:
1 parent
398c0c4113
commit
01e01f3077
1 file changed
+6
-4
+6
-4
@@ -116,11 +116,12 @@ class ThrottledClientSession(aiohttp.ClientSession):
|
|||||||
await self._allow()
|
await self._allow()
|
||||||
return await super()._request(*args,**kwargs)
|
return await super()._request(*args,**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -----------------------------------------------------------
|
## -----------------------------------------------------------
|
||||||
#### Utils
|
#### Utils
|
||||||
## -----------------------------------------------------------
|
## -----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def set_debug(debug: bool):
|
def set_debug(debug: bool):
|
||||||
global _log_level
|
global _log_level
|
||||||
_log_level = DEBUG
|
_log_level = DEBUG
|
||||||
@@ -588,7 +589,8 @@ class WG:
|
|||||||
verbose('Could not find maps file: ' + maps_fn)
|
verbose('Could not find maps file: ' + maps_fn)
|
||||||
self.rate_limiter = None
|
self.rate_limiter = None
|
||||||
if self.WG_app_id != 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')
|
debug('WG aiohttp session initiated')
|
||||||
else:
|
else:
|
||||||
self.session = None
|
self.session = None
|
||||||
@@ -1370,8 +1372,8 @@ class BlitzStars:
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self, rate_limit=30):
|
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):
|
async def close(self):
|
||||||
if self.session != None:
|
if self.session != None:
|
||||||
|
|||||||
Reference in new issue
Block a user