async def request(self, method, url, **kwargs):
rate_limiter = RateLimiter(max_calls=<NUM_LIT>, period=<NUM_LIT>, callback=limited)<EOL>async with rate_limiter:  <EOL><INDENT>if not self.token:<EOL><INDENT>raise UnauthorizedDetected('<STR_LIT>')<EOL><DEDENT>headers = {<EOL>'<STR_LIT>': self.user_agent,<EOL>'<STR_LIT:Content-Type>': '<STR_LIT:application/json>'<EOL>}<EOL>if '<STR_LIT>' in kwargs:<EOL><INDENT>kwargs['<STR_LIT:data>'] = to_json(kwargs.pop('<STR_LIT>'))<EOL><DEDENT>kwargs['<STR_LIT>'] = headers<EOL>headers['<STR_LIT>'] = self.token<EOL>for tries in range(<NUM_LIT:5>):<EOL><INDENT>async with self.session.request(method, url, **kwargs) as resp:<EOL><INDENT>log.debug('<STR_LIT>', method,<EOL>url, kwargs.get('<STR_LIT:data>'), resp.status)<EOL>data = await json_or_text(resp)<EOL>if <NUM_LIT> > resp.status >= <NUM_LIT:200>:<EOL><INDENT>return data<EOL><DEDENT>if resp.status == <NUM_LIT>:  <EOL><INDENT>fmt = '<STR_LIT>'<EOL>retry_after = json.loads(resp.headers.get('<STR_LIT>'))<EOL>mins = retry_after / <NUM_LIT><EOL>log.warning(fmt, retry_after, mins)<EOL>is_global = True  <EOL>if is_global:<EOL><INDENT>self._global_over.clear()<EOL><DEDENT>await asyncio.sleep(retry_after, loop=self.loop)<EOL>log.debug('<STR_LIT>')<EOL>if is_global:<EOL><INDENT>self._global_over.set()<EOL>log.debug('<STR_LIT>')<EOL><DEDENT>continue<EOL><DEDENT>if resp.status == <NUM_LIT>:<EOL><INDENT>raise HTTPException(resp, data)<EOL><DEDENT>elif resp.status == <NUM_LIT>:<EOL><INDENT>raise Unauthorized(resp, data)<EOL><DEDENT>elif resp.status == <NUM_LIT>:<EOL><INDENT>raise Forbidden(resp, data)<EOL><DEDENT>elif resp.status == <NUM_LIT>:<EOL><INDENT>raise NotFound(resp, data)<EOL><DEDENT>else:<EOL><INDENT>raise HTTPException(resp, data)<EOL><DEDENT><DEDENT><DEDENT>raise HTTPException(resp, data)<EOL><DEDENT>
Handles requests to the API