Get a request handler based on the URL of the request, or raises an
        error.  Internal method for caching.

        :param url: request URL
        :param method: request method
        :return: handler, arguments, keyword arguments
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
523374
def match_url(self, path, method='GET'):
        
        path = path.strip().lstrip('/')
        handler, param = self.routes.match(method + ';' + path)
        if handler: return handler, param
        if method == 'HEAD':
            handler, param = self.routes.match('GET;' + path)
            if handler: return handler, param
        handler, param = self.routes.match('ANY;' + path)
        if handler: return handler, param
        return None, {}
1072486
def request(method, *options)
      response_handler = if options.last.is_a?(Hash) && options.last[:handler]
                           options.last.delete(:handler)
                         else
                           handler
                         end

      self.class.base_uri Jiralicious.uri
      before_request if respond_to?(:before_request)
      response = self.class.send(method, *options)
      after_request(response) if respond_to?(:after_request)

      response_handler.call(response)
    end
827982
def get(self, url, headers=None, kwargs=None):
        
        return self._request(
            method='get',
            url=url,
            headers=headers,
            kwargs=kwargs
        )
805343
def request(self, _cache_key, _cache_ignore, _cache_timeout, **kwargs):
        
        if _cache_key:
            # Pop the request's session cookies from the cache key.
            # These appear to be unreliable and change with every
            # request. Also, with the introduction of OAuth I don't think
            # that cookies are being used to store anything that
            # differentiates API requests anyways
            url, items = _cache_key
            _cache_key = (url, (items[0], items[1], items[3], items[4]))

        if kwargs['request'].method != 'GET':
            # I added this check for RTV, I have no idea why PRAW would ever
            # want to cache POST/PUT/DELETE requests
            _cache_ignore = True

        if _cache_ignore:
            return self._request(**kwargs)

        self._clear_timeouts(_cache_timeout)
        if _cache_key in self.cache:
            return self.cache[_cache_key]

        result = self._request(**kwargs)

        # The handlers don't call `raise_for_status` so we need to ignore
        # status codes that will result in an exception that should not be
        # cached.
        if result.status_code not in (200, 302):
            return result

        self.timeouts[_cache_key] = timer()
        self.cache[_cache_key] = result
        return result
248368
def request(self, method, url, **kwargs):
        
        # short circuit if cache isn't configured
        if not self.cache_storage:
            resp = super(CachingSession, self).request(method, url, **kwargs)
            resp.fromcache = False
            return resp

        resp = None
        method = method.lower()

        request_key = self.key_for_request(method, url, **kwargs)

        if request_key and not self.cache_write_only:
            resp = self.cache_storage.get(request_key)

        if resp:
            resp.fromcache = True
        else:
            resp = super(CachingSession, self).request(method, url, **kwargs)
            # save to cache if request and response meet criteria
            if request_key and self.should_cache_response(resp):
                self.cache_storage.set(request_key, resp)
            resp.fromcache = False

        return resp
65408
def request(self, url, method="GET", params=None, headers=None):
        
        params = params or {}
        headers = headers or {}

        logger.debug("URL: %s", url)
        logger.debug("Method: %s", method)
        logger.debug("Headers: %s", headers)
        logger.debug("Params: %s", params)
        
        response, content = self.client().request(url, method, headers=headers,
            body=urllib.urlencode(params))
        
        content = smart_unicode(content)

        logger.debug("Status: %s", response['status'])
        logger.debug("Content: %s", content)
        
        if response['status'] != '200':
            raise OAuthError(_(
                u"Invalid status code %s while requesting %s: %s") % (
                    response['status'], url, content))
        
        return content
197220
def _get(self, url, query=None, **kwargs):
        

        return self._request('get', url, query, **kwargs)
306547
private static Method lookup( String method, String url ) {
    String s = method+url;
    for( String x : _handlers.keySet() )
      if( x.equals(s) )         // TODO: regex
        return _handlers.get(x);
    return null;
  }
715900
def get_handler(self, request):
        
        try:
            f = self._json_rpc_methods[request.method]

        except (AttributeError, KeyError):  # pragma no coverage
            raise RPCMethodError("Received invalid method '{}'".format(request.method))

        return f
1215081
def http_call(self, url=None, **kwargs):
        
        if not url:
            url = self.search_url
        http_func, arg_name = self.get_http_method_arg_name()
        # Build the argument dictionary to pass in the http function
        _kwargs = {
            arg_name: kwargs,
        }
        # The actual HTTP call
        response = http_func(
            url=url.format(**kwargs),
            headers=self.get_http_headers(),
            **_kwargs
        )
        # Error handling
        if response.status_code != 200:
            logger.warning('Invalid Request for `%s`', response.url)
            # Raising a "requests" exception
            response.raise_for_status()
        return response.json()
992084
def get_http_method(self, method):
        """"""
        return self.http_methods[method](self.url, **self.http_method_args)
531096
function getHandler (method, getArgs, service) {
  return function (req, res, next) {
    res.setHeader('Allow', allowedMethods(service).join(','));

    // Check if the method exists on the service at all. Send 405 (Method not allowed) if not
    if (typeof service[method] !== 'function') {
      debug(`Method '${method}' not allowed on '${req.url}'`);
      res.status(statusCodes.methodNotAllowed);
      return next(new errors.MethodNotAllowed(`Method \`${method}\` is not supported by this endpoint.`));
    }

    let params = Object.assign({}, req.params || {});
    delete params.__feathersId;

    // Grab the service parameters. Use req.feathers and set the query to req.query
    params = Object.assign({ query: req.query || {} }, params, req.feathers);

    // Run the getArgs callback, if available, for additional parameters
    const args = getArgs(req, res, next);

    // The service success callback which sets res.data or calls next() with the error
    const callback = function (error, data) {
      const hookArgs = args.concat([ params, callback ]);

      if (error) {
        debug(`Error in REST handler: \`${error.message || error}\``);
        res.hook = hookObject(method, 'error', hookArgs);
        return next(error);
      }

      res.data = data;
      res.hook = hookObject(method, 'after', hookArgs);

      if (!data) {
        debug(`No content returned for '${req.url}'`);
        res.status(statusCodes.noContent);
      } else if (method === 'create') {
        res.status(statusCodes.created);
      }

      return next();
    };

    debug(`REST handler calling \`${method}\` from \`${req.url}\``);
    service[method].apply(service, args.concat([ params, callback ]));
  };
}
613715
def _get_method(self, request):
        
        methodname = request.method.lower()
        method = getattr(self, methodname, None)
        if not method or not callable(method):
            raise errors.MethodNotAllowed()
        return method
552675
def request(self,
                method: str,
                url: StrOrURL,
                **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(self._request(method, url, **kwargs))
1196864
def handle(self, url, method):
        
        if not self.serve:
            return HTTPError(503, "Server stopped")

        handler, args = self.match_url(url, method)
        if not handler:
            return HTTPError(404, "Not found:" + url)

        try:
            return handler(**args)
        except HTTPResponse, e:
            return e
        except Exception, e:
            if isinstance(e, (KeyboardInterrupt, SystemExit, MemoryError))\
            or not self.catchall:
                raise
            return HTTPError(500, 'Unhandled exception', e, format_exc(10))
977373
def __request(self, method, url, request_args, headers=None, stream=False):
        
        func = getattr(self.client, method)
        headers = headers if headers else {}
        response = None
        try:
            logger.info("performing request %s", url)
            response = func(url, stream=stream, headers=headers,
                            **request_args)
        except requests.RequestException as err:
            logger.error("request %s failed [%s]", url, err)
            raise err

        # Handle error responses
        if response.status_code >= 400:
            logger.error("request %s failed [%d,%s]",
                         url,
                         response.status_code,
                         response.content.decode('utf-8'))
            raise V20Error(response.status_code,
                           response.content.decode('utf-8'))
        return response