def add_request(self, request):
<EOL>if request.name in self.requests:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(request.name))<EOL><DEDENT>self.requests[request.name] = request<EOL>for method, url in request.urls:<EOL><INDENT>if RE_URL_ARG.search(url):<EOL><INDENT>request_regex = '<STR_LIT>' + RE_URL_ARG_ESC.sub(r'<STR_LIT>', re.escape(url)) + '<STR_LIT:$>'<EOL>self.__request_regex.append((method, re.compile(request_regex), request))<EOL><DEDENT>else:<EOL><INDENT>request_key = (method, url)<EOL>if request_key in self.__request_urls:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(url))<EOL><DEDENT>self.__request_urls[request_key] = request<EOL><DEDENT><DEDENT>
Add a request object