Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, loop, **attrs):
self.client_id = client_id = attrs.get('client_id', None)
if not client_id:
log.warning('Running without client ID, some HTTP endpoints may not work without authentication.')
self._bucket = RateBucket(method='http')
self._session = aiohttp.ClientSession(loop=loop)
def get_bucket(self, channel: str, method: str) -> RateBucket:
try:
bucket = self.buckets[channel]
except KeyError:
bucket = RateBucket(method=method)
self.buckets[channel] = bucket
if bucket.method != method:
bucket.method = method
if method == 'mod':
bucket.limit = bucket.MODLIMIT
else:
bucket.limit = bucket.IRCLIMIT
self.buckets[channel] = bucket
return bucket