Try to dispatch the request.

        :return object: result
4488
def dispatch(self, request, **resources):
        

        # Fix PUT and PATH methods in Django request
        request = fix_request(request)

        # Set self identifier
        self.identifier = request.META.get('REMOTE_ADDR', 'anonymous')

        # Send ADREST started signal
        api_request_started.send(self, request=request)

        # Send current api started signal
        if self.api:
            self.api.request_started.send(self, request=request)

        try:

            # Check request method
            self.check_method_allowed(request)

            # Authentificate
            self.authenticate(request)

            # Throttle check
            self.throttle_check()

            if request.method != 'OPTIONS' or not ADREST_ALLOW_OPTIONS:

                # Parse content
                request.data = self.parse(request)

                # Get required resources
                resources = self.get_resources(
                    request, **resources)

                # Check owners
                self.check_owners(request, **resources)

                # Check rights for resources with this method
                self.check_rights(resources, request=request)

            response = self.handle_request(request, **resources)

            # Serialize response
            response = self.emit(response, request=request)

        except Exception as e:
            response = self.handle_exception(e, request=request)

        response["Allow"] = ', '.join(self._meta.allowed_methods)
        response["Vary"] = 'Authenticate, Accept'

        # Send errors on mail
        adrest_errors_mail(response, request)

        # Send finished signal
        api_request_finished.send(
            self, request=request, response=response, **resources)

        # Send finished signal in API context
        if self.api:
            self.api.request_finished.send(
                self, request=request, response=response, **resources)

        return response
1151817
def dispatch(self, method, url, auth=None, params=None, **kwargs):
        
        r = Request(
            method=method,
            url=url,
            auth=auth,
            params=params,
            data=kwargs)
        s = Session()
        resp = s.send(r.prepare())
        status = resp.status_code
        text = resp.text
        error = resp.reason
        if status >= 200 and status < 300:
            if text:
                try:
                    return (True, json.loads(text))
                except TypeError:
                    pass
                except ValueError:
                    pass
            return (True, text)
        elif status >= 300 and status < 400:
            return (
                False,
                'Unauthorized access, '
                'please check your credentials.')
        elif status >= 400 and status < 500:
            return (False, 'Service not found.')
        elif status >= 500 and status < 600:
                return (False, 'Server error.')
        else:
            return (False, error)
622643
def dispatch(self, request, *args, **kwargs):
        
        self.request = request
        self.args = args
        self.kwargs = kwargs
        response = self.check_permissions(request)
        if response:
            return response
        return super().dispatch(request, *args, **kwargs)
996369
async def dispatch_websocket(
        self, websocket_context: Optional[WebsocketContext]=None,
    ) -> None:
        
        websocket_ = (websocket_context or _websocket_ctx_stack.top).websocket
        if websocket_.routing_exception is not None:
            raise websocket_.routing_exception

        handler = self.view_functions[websocket_.url_rule.endpoint]
        return await handler(**websocket_.view_args)
853272
def dispatch(self, request, *args, **kwargs):
        
        if self.requires_login:
            if settings.LOGIN_URL is None or settings.LOGOUT_URL is None:
                raise ImproperlyConfigured(
                    "LOGIN_URL and LOGOUT_URL "
                    "has to be defined if requires_login is True"
                )

            if not request.user.is_authenticated:
                return redirect(
                    "%s?next=%s"
                    % (
                        resolve_url(settings.LOGIN_URL),
                        quote(request.get_full_path()),
                    )
                )

        return super(View, self).dispatch(request, *args, **kwargs)
978817
def dispatch(self):
        
        from flask import request

        method = request.method

        data = request.args
        if method == 'POST':
            data = request.form

        token = data.get('token')
        team_id = data.get('team_id')
        command = data.get('command') or data.get('trigger_word')

        if isinstance(command, string_types):
            command = command.strip().lstrip('/')

        try:
            self.validate(command, token, team_id, method)
        except SlackError as e:
            return self.response(e.msg)

        func, _, _, kwargs = self._commands[(team_id, command)]
        kwargs.update(data.to_dict())

        return func(**kwargs)
921630
public function dispatch()
	{
		if(!self::$isDispatched){
		    if (PHP_SAPI == 'cli') {
		        $this->dispatchCli();
		    } else {
                $this->dispatchHttp();
		    }
            self::$isDispatched = true;
        }
    }
1326945
def dispatch_error(self, err):
        '''
        
        '''
        try:
            data = {'error': [l for l in err.args]}
            body = self._meta.formatter.format(data)
        except Exception as ex:
            data = {'error': str(err)}
            body = self._meta.formatter.format(data)

        status = getattr(err, 'status', 500)
        return self.build_http_response(body, status=status)
47912
async def dispatch(self, request, view=None, **kwargs):
        """"""
        if view is None and request.method not in self.methods:
            raise HTTPMethodNotAllowed(request.method, self.methods)

        method = getattr(self, view or request.method.lower())
        response = await method(request, **kwargs)
        return await self.make_response(request, response)
327324
def dispatch(self, request, *args, **kwargs):
        
        allowed_methods = self.get_allowed_methods()
        try:
            if request.method == 'GET' and 'GET' in allowed_methods:
                if 'pk' in request.GET or self.slug_field in request.GET:
                    return self.ng_get(request, *args, **kwargs)
                return self.ng_query(request, *args, **kwargs)
            elif request.method == 'POST' and 'POST' in allowed_methods:
                return self.ng_save(request, *args, **kwargs)
            elif request.method == 'DELETE' and 'DELETE' in allowed_methods:
                return self.ng_delete(request, *args, **kwargs)
        except self.model.DoesNotExist as e:
            return self.error_json_response(e.args[0], 404)
        except NgMissingParameterError as e:
            return self.error_json_response(e.args[0])
        except JSONResponseException as e:
            return self.error_json_response(e.args[0], e.status_code)
        except ValidationError as e:
            if hasattr(e, 'error_dict'):
                return self.error_json_response('Form not valid', detail=e.message_dict)
            else:
                return self.error_json_response(e.message)

        return self.error_json_response('This view can not handle method {0}'.format(request.method), 405)
690078
async def dispatch_request(
        self, request_context: Optional[RequestContext]=None,
    ) -> ResponseReturnValue:
        
        request_ = (request_context or _request_ctx_stack.top).request
        if request_.routing_exception is not None:
            raise request_.routing_exception

        if request_.method == 'OPTIONS' and request_.url_rule.provide_automatic_options:
            return await self.make_default_options_response()

        handler = self.view_functions[request_.url_rule.endpoint]
        return await handler(**request_.view_args)
727545
def call(self, **data):
        
        uri, body, headers = self.prepare(data)
        return self.dispatch(uri, body, headers)
932617
def dispatch_to_awaiting(self,result):
        

        # If we are awaiting to login, then we might also get
        # an abort message. Handle that here....
        if self._state == STATE_AUTHENTICATING:
            # If the authentication message is something unexpected,
            # we'll just ignore it for now
            if result == WAMP_ABORT \
               or result == WAMP_WELCOME \
               or result == WAMP_GOODBYE:
                self._welcome_queue.put(result)
            return

        try:
            request_id = result.request_id
            if request_id in self._requests_pending:
                self._requests_pending[request_id].put(result)
                del self._requests_pending[request_id]
        except:
            raise Exception("Response does not have a request id. Do not know who to send data to. Data: {} ".format(result.dump()))
448888
def dispatch_queue(self):
        
        self.queue_lock.acquire()
        q = list(self.queue)
        self.queue = []
        self.queue_lock.release()
        log.debug("Dispatching requests: {}".format(q))
        for req in q:
            req.response = self.dispatch_request(req)
        for req in q:
            req.signal()
693647
def dispatch!
      invoke do
        static! if settings.static? && (request.get? || request.head?)
        filter! :before
        route!
      end
    rescue ::Exception => boom
      invoke { handle_exception!(boom) }
    ensure
      filter! :after unless env['sinatra.static_file']
    end
131436
def dispatch(self, event: Event) -> Iterator[Any]:
        
        LOG.debug('Dispatching event "%s"', event.get("type"))
        if event["type"] in self._routes:
            for detail_key, detail_values in self._routes.get(
                event["type"], {}
            ).items():
                event_value = event.get(detail_key, "*")
                yield from detail_values.get(event_value, [])
        else:
            return
1003421
def dispatch_hook(key, hooks, hook_data):
    """"""

    hooks = hooks or dict()

    if key in hooks:
        try:
            return hooks.get(key).__call__(hook_data) or hook_data

        except Exception, why:
            warnings.warn(str(why))

    return hook_data