Utility method that performs all requests.
482797
def _perform_request(self, request_type, resource, **kwargs):
        '''
        
        '''
        request_type_methods = set(["get", "post", "put", "delete"])
        if request_type not in request_type_methods:
            raise Exception("Unknown request type. Supported request types are"
                            ": {0}".format(", ".join(request_type_methods)))

        uri = "{0}{1}{2}".format(self.uri_prefix, self.domain, resource)

        # set a timeout, just to be safe
        kwargs["timeout"] = self.timeout

        response = getattr(self.session, request_type)(uri, **kwargs)

        # handle errors
        if response.status_code not in (200, 202):
            _raise_for_status(response)

        # when responses have no content body (ie. delete, set_permission),
        # simply return the whole response
        if not response.text:
            return response

        # for other request types, return most useful data
        content_type = response.headers.get('content-type').strip().lower()
        if re.match(r'application\/json', content_type):
            return response.json()
        elif re.match(r'text\/csv', content_type):
            csv_stream = StringIO(response.text)
            return [line for line in csv.reader(csv_stream)]
        elif re.match(r'application\/rdf\+xml', content_type):
            return response.content
        elif re.match(r'text\/plain', content_type):
            try:
                return json.loads(response.text)
            except ValueError:
                return response.text
        else:
            raise Exception("Unknown response format: {0}"
                            .format(content_type))
145325
def execute(self):
        
        if bool(self.files) is False:
            response = requests.post(self.url, json=self.json, proxies=self.proxies)
        else:
            self.files['payload_json'] = (None, json.dumps(self.json))
            response = requests.post(self.url, files=self.files, proxies=self.proxies)
        if response.status_code in [200, 204]:
            logger.debug("Webhook executed")
        else:
            logger.error('status code %s: %s' % (response.status_code, response.content.decode("utf-8")))
1316419
public function handleRequests(): void
    {
        $tail_call = false;
        do {
            $this->arg = $this->simpleArg;
            $this->stack = [$this->arg];
            $this->idx = 0;
            $this->parser->parse();
            if (count($this->stack) > 1) {
                $arg = array_pop($this->stack);
                if ($arg instanceof ApplyArg) {
                    $this->apply($arg);
                } else {
                    $msg = 'Error: $arg should be of type ApplyArg, error in client';
                    $this->logger->critical($msg);
                    throw new Exception\RuntimeException($msg);
                }
                $tail_call = true;
            }
            $this->stack = null;
        } while ($tail_call);
    }
195201
def all(cls, connection=None, **params):
        

        request = cls._make_request('GET', cls._get_all_path(), connection, params=params)
        return cls._create_object(request, connection=connection)
1071482
def all(self, endpoint, *args, **kwargs):
        
        # 1. Initialize the pagination parameters.
        kwargs.setdefault('params', {})['offset'] = 0
        kwargs.setdefault('params', {})['limit'] = self.limit
        kwargs['__method__'] = 'get'
        # 2. Create an initial paginated request.
        payload = self.request(endpoint, *args, **kwargs)
        has_next = payload.get('result', {}).setdefault(
            'meta', {'next': None}
        )['next']
        # 3. Loop until the end
        while has_next:
            # 4. Increment the offset
            kwargs['params']['offset'] += self.limit
            # 5. Query again
            _payload = self.request(endpoint, *args, **kwargs)
            # 6. Add the paginated data to the global one
            payload['result']['data'].extend(_payload['result']['data'])
            # 7. Compute has_next
            has_next = _payload['result']['meta']['next']
        del payload['result']['meta']
        return payload
310652
public static function runAll()
    {
        self::checkSapiEnv();
        self::init();
        self::parseCommand();
        self::daemonize();
        self::initWorkers();
        self::installSignal();
        self::saveMasterPid();
        self::forkWorkers();
        self::displayUI();
        self::resetStd();
        self::monitorWorkers();
    }
967384
def execute(method, *args)
      new_args = args

      @pre_request.each do |middleware|
        new_args = middleware.call(*new_args)
      end

      path = new_args.empty? ? '' : new_args.shift

      req = proc do ||
        @resource[path].send(method, *new_args)
      end

      post = proc do |result|
        @post_request.each do |middleware|
          result = middleware.call(result)
        end

        result
      end

      Concurrent::Promise.new(&req).on_success(&post)
    end
1250528
public function run()
    {
        $resolvedRequest = $this->router->route($this->request);
        echo $this->dispatcher->dispatch($resolvedRequest);
    }
1062308
public function start() {

        // indicate the library that it should execute queued requests
        $this->_queue = false;

        // if we have to pause between batches of requests, process them sequentially, in batches
        if ($this->pause_interval > 0) $this->_process_paused();

        // if we don't have to pause between batches of requests, process them all at once
        else $this->_process();

    }
437508
def request(self, *args, **kwargs):
        
        func = partial(super().request, *args, **kwargs)
        return self.loop.run_in_executor(self.thread_pool, func)
692427
def request(self, *args, **kwargs):
        """"""
        try:
            return self._http.request(*args, timeout=TIMEOUT, **kwargs)
        except Exception as exc:
            raise RequestException(exc, args, kwargs)
1106722
def process_request(self, request, response):
        """"""
        self.logger.info('Requested: {0} {1} {2}'.format(request.method, request.relative_uri, request.content_type))
503722
def requests_request(method, url, **kwargs):
    """"""
    session = local_sessions.session
    response = session.request(method=method, url=url, **kwargs)
    session.close()
    return response
117132
public void request(List<org.apache.mesos.v1.Protos.Request> requests) {
    Builder request = build().setRequest(Request.newBuilder().addAllRequests(requests));
    sendCall(request, Type.REQUEST);
  }
462983
async def dispatch(self, request, view=None, **kwargs):
        """"""
        # Authorization endpoint
        self.auth = await self.authorize(request, **kwargs)  # noqa

        # Load collection
        self.collection = await self.get_many(request, **kwargs)

        if request.method == 'POST' and view is None:
            return await super(RESTHandler, self).dispatch(request, **kwargs)

        # Load resource
        resource = await self.get_one(request, **kwargs)

        headers = {}

        if request.method == 'GET' and resource is None:

            # Filter resources
            if VAR_WHERE in request.query:
                self.collection = await self.filter(request, **kwargs)

            # Sort resources
            if VAR_SORT in request.query:
                sorting = [(name.strip('-'), name.startswith('-'))
                           for name in request.query[VAR_SORT].split(',')]
                self.collection = await self.sort(*sorting, **kwargs)

            # Paginate resources
            per_page = request.query.get(VAR_PER_PAGE, self.meta.per_page)
            if per_page:
                try:
                    per_page = int(per_page)
                    if per_page:
                        page = int(request.query.get(VAR_PAGE, 0))
                        offset = page * per_page
                        self.collection, total = await self.paginate(request, offset, per_page)
                        headers = make_pagination_headers(
                            request, per_page, page, total, self.meta.page_links)
                except ValueError:
                    raise RESTBadRequest(reason='Pagination params are invalid.')

        response = await super(RESTHandler, self).dispatch(
            request, resource=resource, view=view, **kwargs)
        response.headers.update(headers)
        return response
433726
def perform(self):
        
        for request in self._cfg[Integrator._CFG_KEY_REQUESTS]:
            request_type = self._cfg[Integrator._CFG_KEY_REQUESTS][request][Integrator._CFG_KEY_REQUEST_TYPE]
            request_cfg_file = self._cfg[Integrator._CFG_KEY_REQUESTS][request][Integrator._CFG_KEY_REQUEST_CFG_FILE]
            self._logger.debug('{}'.format(request_cfg_file))
            self._process_request(request, request_type, request_cfg_file)
510420
def execute_all(event, object)
      each_subscription_id(event) do |subscription_id|
        execute(subscription_id, event, object)
      end
    end