def request(self,<EOL>method,<EOL>path,<EOL>body=None,<EOL>headers={},<EOL>exception_fn=None,<EOL>notimeout=False,<EOL>verify=True):
<EOL>if not self.reuseconnection or notimeout:<EOL><INDENT>self.close()<EOL>self.session = Session()<EOL><DEDENT>allheaders = headers<EOL>allheaders.update(self.session.headers)<EOL>try:<EOL><INDENT>if self.curldebug:<EOL><INDENT>def escape(s):<EOL><INDENT>"""<STR_LIT>"""<EOL>return s.replace("<STR_LIT:'>", "<STR_LIT>")<EOL><DEDENT>self.log.debug(<EOL>"<STR_LIT>".format(<EOL>'<STR_LIT>' if self.https else '<STR_LIT:http>',<EOL>self.host,<EOL>path,<EOL>method,<EOL>self.httptimeout,<EOL>'<STR_LIT:U+0020>'.join(['<STR_LIT>'.format(escape(h), escape(allheaders[h]))<EOL>for h in allheaders]),<EOL>'<STR_LIT>' if body is None else '<STR_LIT>' + escape(body) + '<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>self.log.debug("<STR_LIT>" % (<EOL>method,<EOL>path,<EOL>self.host,<EOL>allheaders))<EOL>if body is not None:<EOL><INDENT>self.log.debug("<STR_LIT>" % body)<EOL><DEDENT><DEDENT>URI = self.host + path<EOL>prepped = self.session.prepare_request(<EOL>Request(method, URI, data=body, headers=headers)<EOL>)<EOL>response = self.session.send(<EOL>prepped,<EOL>verify=verify,<EOL>timeout=None if notimeout else self.httptimeout<EOL>)<EOL>return response.text, response<EOL><DEDENT>except Exception:<EOL><INDENT>self.close()<EOL>ex = sys.exc_info()[<NUM_LIT:1>]<EOL>if exception_fn is not None:<EOL><INDENT>exception_fn(ex)<EOL><DEDENT>else:<EOL><INDENT>raise ex<EOL><DEDENT><DEDENT>
Wraps HTTPConnection.request. On exception it calls exception_fn
        with the exception object. If exception_fn is None, it re-raises the
        exception. If notimeout is True, create a new connection (regardless of
        self.reuseconnection setting) that uses the global default timeout for
        sockets (usually None).