def request(method, url, **kwargs):
time_before_request = time()<EOL>session = SessionSinglePool()<EOL>kwargs['<STR_LIT>'] = settings['<STR_LIT>'].get('<STR_LIT>') or None<EOL>if '<STR_LIT>' in kwargs:<EOL><INDENT>timeout = kwargs['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>timeout = getattr(threadLocal, '<STR_LIT>', None)<EOL>if timeout is not None:<EOL><INDENT>kwargs['<STR_LIT>'] = timeout<EOL><DEDENT><DEDENT>response = session.request(method=method, url=url, **kwargs)<EOL>time_after_request = time()<EOL>if timeout is not None:<EOL><INDENT>timeout_overhead = <NUM_LIT>  <EOL>start_time = getattr(threadLocal, '<STR_LIT>', time_before_request)<EOL>search_duration = time_after_request - start_time<EOL>if search_duration > timeout + timeout_overhead:<EOL><INDENT>raise requests.exceptions.Timeout(response=response)<EOL><DEDENT><DEDENT>session.close()<EOL>if hasattr(threadLocal, '<STR_LIT>'):<EOL><INDENT>threadLocal.total_time += time_after_request - time_before_request<EOL><DEDENT>return response<EOL>
same as requests/requests/api.py request(...)