original_docstring: 
          Adds a route with given mocked response details.
          
docstring: Adds a route with given mocked response details.
docstring_tokens: Adds a route with given mocked response details .
code: def add(
          self,
          route: Optional[Union[str, Route, Callable]] = None,
          url: Optional[URLPatternTypes] = None,
          *,
          params: Optional[QueryParamTypes] = None,
          method: Optional[str] = None,
          status_code: Optional[int] = None,
          headers: Optional[HeaderTypes] = None,
          content_type: Optional[str] = None,
          content: Optional[ContentDataTypes] = None,
          text: Optional[str] = None,
          html: Optional[str] = None,
          json: Optional[JSONTypes] = None,
          pass_through: bool = False,
          alias: Optional[str] = None,
          name: Optional[str] = None,
      ) -> Route:
          """
          Adds a route with given mocked response details.
          """
          if callable(route) and not isinstance(route, Route):
              route = Route().side_effect(route)
  
          elif isinstance(route, str):
              warn(
                  "Passing method as string to respx.add is deprecated. "
                  "Please, use respx.route(method=...) or respx.get(...)",
                  category=DeprecationWarning,
              )
              method = route
              route = None
  
          if route is None:
              url__lookup = "url__regex" if isinstance(url, Regex) else "url__contains"
              route = Route(
                  **{"method": method, url__lookup: url, "params": params},
              )
  
          response = None
          if (
              status_code is not None
              or headers is not None
              or content_type is not None
              or content is not None
              or text is not None
              or html is not None
              or json is not None
              or pass_through is True
          ):
              if route.has_side_effect:
                  raise NotImplementedError(
                      "Mixing callback with response details is no longer supported"
                  )
  
              warn(
                  "Response kwargs among request pattern kwargs is deprecated. "
                  "Please, use .respond(...) or % operator.",
                  category=DeprecationWarning,
              )
  
              response = MockResponse(
                  status_code,
                  headers=headers,
                  content_type=content_type,
                  content=content,
                  text=text,
                  html=html,
                  json=json,
              )
  
          if response:
              route.add_response(response)
  
          if pass_through:
              route.pass_through()
  
          if alias:
              warn(
                  'Route alias kwarg is deprecated. Please use name="".',
                  category=DeprecationWarning,
              )
              name = alias
          if name:
              route.name = name
  
          route_key = route.name or hash(route)
          if route_key in self.routes:
              # Identical route already exists, stack responses
              existing_route = self.routes[route_key]
              existing_route._responses.extend(route._responses)
              route = existing_route
          else:
              self.routes[route_key] = route
  
          return route
code_tokens: def add ( self , route : Optional [ Union [ str , Route , Callable ] ] = None , url : Optional [ URLPatternTypes ] = None , * , params : Optional [ QueryParamTypes ] = None , method : Optional [ str ] = None , status_code : Optional [ int ] = None , headers : Optional [ HeaderTypes ] = None , content_type : Optional [ str ] = None , content : Optional [ ContentDataTypes ] = None , text : Optional [ str ] = None , html : Optional [ str ] = None , json : Optional [ JSONTypes ] = None , pass_through : bool = False , alias : Optional [ str ] = None , name : Optional [ str ] = None , ) -> Route : if callable ( route ) and not isinstance ( route , Route ) : route = Route ( ) . side_effect ( route ) elif isinstance ( route , str ) : warn ( "Passing method as string to respx.add is deprecated. " "Please, use respx.route(method=...) or respx.get(...)" , category = DeprecationWarning , ) method = route route = None if route is None : url__lookup = "url__regex" if isinstance ( url , Regex ) else "url__contains" route = Route ( ** { "method" : method , url__lookup : url , "params" : params } , ) response = None if ( status_code is not None or headers is not None or content_type is not None or content is not None or text is not None or html is not None or json is not None or pass_through is True ) : if route . has_side_effect : raise NotImplementedError ( "Mixing callback with response details is no longer supported" ) warn ( "Response kwargs among request pattern kwargs is deprecated. " "Please, use .respond(...) or % operator." , category = DeprecationWarning , ) response = MockResponse ( status_code , headers = headers , content_type = content_type , content = content , text = text , html = html , json = json , ) if response : route . add_response ( response ) if pass_through : route . pass_through ( ) if alias : warn ( 'Route alias kwarg is deprecated. Please use name="".' , category = DeprecationWarning , ) name = alias if name : route . name = name route_key = route . name or hash ( route ) if route_key in self . routes : existing_route = self . routes [ route_key ] existing_route . _responses . extend ( route . _responses ) route = existing_route else : self . routes [ route_key ] = route return route
short_docstring: Adds a route with given mocked response details.
short_docstring_tokens: Adds a route with given mocked response details .
comment: """
          Adds a route with given mocked response details.
          """$SEP$# Identical route already exists, stack responses