Get the route (Route) based on the current request

        :param request flask_request: Flask Request
        :return: Route matching the endpoint and method of the request
191205
def _get_current_route(self, flask_request):
        
        endpoint = flask_request.endpoint
        method = flask_request.method

        route_key = self._route_key(method, endpoint)
        route = self._dict_of_routes.get(route_key, None)

        if not route:
            LOG.debug("Lambda function for the route not found. This should not happen because Flask is "
                      "already configured to serve all path/methods given to the service. "
                      "Path=%s Method=%s RouteKey=%s", endpoint, method, route_key)
            raise KeyError("Lambda function for the route not found")

        return route
314338
public function getRouteForRequest(Request $request)
    {
        $routes = $this->collection->get($request->getMethod());

        return $this->check($routes, $request);
    }
709705
public function route(Request $request)
    {
        foreach ($this->getRouterList() as $router) {
            if ($router->getAPIClient()->shouldRouteRequest($request)) {
                return $router->route($request);
            }
        }

        return;
    }
528211
def handleFlaskPostRequest(flaskRequest, endpoint):
    
    if flaskRequest.method == "POST":
        return handleHttpPost(flaskRequest, endpoint)
    elif flaskRequest.method == "OPTIONS":
        return handleHttpOptions()
    else:
        raise exceptions.MethodNotAllowedException()
173611
def _get(self, url, method, host):
        
        url = host + url
        # Check against known static routes
        route = self.routes_static.get(url)
        method_not_supported = self._invalid_usage(
            'Method {} not allowed for URL {}'.format(
                method, url), status_code=405)
        if route:
            if route.methods and method not in route.methods:
                raise method_not_supported
            match = route.pattern.match(url)
        else:
            route_found = False
            # Move on to testing all regex routes
            for route in self.routes_dynamic[url_hash(url)]:
                match = route.pattern.match(url)
                route_found |= match is not None
                # Do early method checking
                if match and method in route.methods:
                    break
            else:
                # Lastly, check against all regex routes that cannot be hashed
                for route in self.routes_always_check:
                    match = route.pattern.match(url)
                    route_found |= match is not None
                    # Do early method checking
                    if match and method in route.methods:
                        break
                else:
                    # Route was found but the methods didn't match
                    if route_found:
                        raise method_not_supported
                    raise self._not_found(
                        'Requested URL {} not found'.format(url))

        kwargs = {p.name: p.cast(value)
                  for value, p
                  in zip(match.groups(1), route.parameters)}
        route_handler = route.handler
        if hasattr(route_handler, 'handlers'):
            route_handler = route_handler.handlers[method]
        return route_handler, [], kwargs, route.uri
1314649
def parse_request(self, request, parameters=None, fake_method=None):
        '''
        
        '''
        return (request.method,
                request.url,
                request.headers,
                request.form.copy())
3268
def get_route(self, file_id):

        ''' 
        '''

        title = '%s.get_route' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'file_id': file_id,
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # construct key word arguments
        request_kwargs = {
            'url': '%s/getFile' % self.api_endpoint,
            'data': {
                'file_id': file_id
            }
        }

    # send request
        response_details = self._post_request(**request_kwargs)

        return response_details
294652
def get(self, request):
        '''
        '''
        data = {}
        for router in self.routes:
            data[router.name] = request.absolute_uri(router.path())
        return Json(data).http_response(request)
399480
protected function findRoute($request)
    {
        $this->current = $route = $this->routes->match($request);

        $this->container->instance(Route::class, $route);

        return $route;
    }
65064
def endpoint(request):
    
    s = getServer(request)

    query = util.normalDict(request.GET or request.POST)

    # First, decode the incoming request into something the OpenID
    # library can use.
    try:
        openid_request = s.decodeRequest(query)
    except ProtocolError, why:
        # This means the incoming request was invalid.
        return direct_to_template(
            request,
            'server/endpoint.html',
            {'error': str(why)})

    # If we did not get a request, display text indicating that this
    # is an endpoint.
    if openid_request is None:
        return direct_to_template(
            request,
            'server/endpoint.html',
            {})

    # We got a request; if the mode is checkid_*, we will handle it by
    # getting feedback from the user or by checking the session.
    if openid_request.mode in ["checkid_immediate", "checkid_setup"]:
        return handleCheckIDRequest(request, openid_request)
    else:
        # We got some other kind of OpenID request, so we let the
        # server handle this.
        openid_response = s.handleRequest(openid_request)
        return displayResponse(request, openid_response)
851317
def get_request(self, request):
        
        return [DownloadRequest(url=self._get_url(item),
                                filename=self._get_filename(request, item),
                                data_type=request.image_format)
                for item in self._get_items(request)]
1374291
def _do_request(request):
    
    if request.request_type is RequestType.GET:
        return requests.get(request.url, headers=request.headers)
    if request.request_type is RequestType.POST:
        return requests.post(request.url, data=json.dumps(request.post_values), headers=request.headers)
    raise ValueError('Invalid request type {}'.format(request.request_type))
719480
def request(self, request):
        

        url = "{}{}".format(self._base_url, request.path)

        timeout = self.poll_timeout

        if request.stream is True:
            timeout = self.stream_timeout

        try:
            http_response = self._session.request(
                request.method,
                url,
                headers=self._headers,
                params=request.params,
                data=request.body,
                stream=request.stream,
                timeout=timeout
            )
        except requests.exceptions.ConnectionError:
            raise V20ConnectionError(url)
        except requests.exceptions.ConnectTimeout:
            raise V20Timeout(url, "connect")
        except requests.exceptions.ReadTimeout:
            raise V20Timeout(url, "read")

        request.headers = http_response.request.headers

        response = Response(
            request,
            request.method,
            http_response.url,
            http_response.status_code,
            http_response.reason,
            http_response.headers
        )

        if request.stream:
            response.set_line_parser(
                request.line_parser
            )

            response.set_lines(
                http_response.iter_lines(
                    self.stream_chunk_size
                )
            )
        else:
            response.set_raw_body(http_response.text)

        return response
983820
public function route(Request &$request)
	{
		$matcher = $this->routerContainer->getMatcher();
		$route = $matcher->match($request);
		if (!$route) {
			return false;
		}

		foreach ($route->extras as $key => $val) {
			$request = $request->withAttribute($key, $val);
		}
		foreach ($route->attributes as $key => $val) {
			$request = $request->withAttribute($key, $val);
		}
		$request = $request->withAttribute('route.name', $route->name);

		return $route->handler;
	}
591074
def get(self, request):
        
        # No virtual hosts specified; default behavior
        if not self.hosts:
            return self._get(request.path, request.method, "")
        # virtual hosts specified; try to match route to the host header
        try:
            return self._get(
                request.path, request.method, request.headers.get("Host", "")
            )
        # try default hosts
        except NotFound:
            return self._get(request.path, request.method, "")
158209
def next(self):
        
        next = request.args.get('next')
        if next is None:
            params = self.default_redirect_params
            next = url_for(self.default_redirect_endpoint, **params)
        return next
341723
def parse_request(self, request, parameters, fake_method=None):
        '''
        
        '''
        return (fake_method or request.method,
                request.build_absolute_uri(),
                request.META,
                (dict(request.POST.iteritems())
                    if request.method == 'POST'
                    else parameters))