Wrapper for the HTTP Request,
        Rate Limit Backoff is handled here,
        Responses are Processed with ResourceBuilder.
767253
def _get(self, url, query=None):
        

        if query is None:
            query = {}

        response = retry_request(self)(self._http_get)(url, query=query)

        if self.raw_mode:
            return response

        if response.status_code != 200:
            error = get_error(response)
            if self.raise_errors:
                raise error
            return error

        localized = query.get('locale', '') == '*'
        return ResourceBuilder(
            self.default_locale,
            localized,
            response.json(),
            max_depth=self.max_include_resolution_depth,
            reuse_entries=self.reuse_entries
        ).build()
657884
def rate_limit_ensembl_requests(self):
        
        
        current_time = time.time()
        diff_time = current_time - self.prior_time
        
        # sleep until the current rate limit period is finished
        if diff_time < self.rate_limit:
            time.sleep(self.rate_limit - diff_time)
        
        # set the access time to now, for later checks
        self.prior_time = time.time()
576193
private void handleNewRequest() {

        // if this is an http/2 request, skip to discrimination
        if (!isAlpnHttp2Link(this.vc)) {
            final HttpInboundServiceContextImpl sc = getHTTPContext();
            // save the request info that was parsed in case somebody changes it
            sc.setRequestVersion(sc.getRequest().getVersionValue());
            sc.setRequestMethod(sc.getRequest().getMethodValue());

            // get the response message initialized. Note: in the proxy env, this
            // response message will be overwritten; however, this is the only
            // spot to init() it correctly for all other cases.
            sc.getResponseImpl().init(sc);

            this.numRequestsProcessed++;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Received request number " + this.numRequestsProcessed + " on link " + this);
            }

            // check for the 100-continue scenario
            if (!sc.check100Continue()) {
                return;
            }
        }
        handleDiscrimination();
    }
450145
protected /*HttpBuilder*/void streamOut(InputStream in) {
//        StreamResponse resp = new StreamResponse(context, in);
//        context.setControllerResponse(resp);
//        return new HttpBuilder(resp);
        //TODO finish and TEST the god damn method
        //------------------
        Result r = ResultBuilder.ok()
                .contentType(MediaType.APPLICATION_OCTET_STREAM)
                .renderable(in);
//        context.setControllerResponse(r);
        result = r;
    }
654949
def rate_limit(self, rate_limit):
        
        self._rate_limit = bool(rate_limit)
        self._rate_limit_last_call = None
        self.clear_memoized()
585012
private void handleRequestAndRespond(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
        RDFUnitConfiguration configuration = null;
        try {
            configuration = getConfiguration(httpServletRequest);
        } catch (ParameterException e) {
            String message = e.getMessage();
            if (message != null) {
                printMessage(httpServletResponse, message);
            }
            printHelpMessage(httpServletResponse);
            httpServletResponse.getWriter().close();
            return;
        }
        assert configuration != null;

        final TestSource dataset = configuration.getTestSource();

        final TestSuite testSuite = getTestSuite(configuration, dataset);
        assert testSuite != null;

        TestExecution results = null;
        try {
            results = validate(configuration, dataset, testSuite);
        } catch (TestCaseExecutionException e) {
            // TODO catch error
        }
        assert results != null;

        try {
            writeResults(configuration, results, httpServletResponse);
        } catch (RdfWriterException e) {
            printMessage(httpServletResponse, e.getMessage());
        }
    }
494261
@Override
  public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)
      throws IOException {
    if (!supportsRetry) {
      return false;
    }
    // check if back-off is required for this response
    if (backOffRequired.isRequired(response)) {
      try {
        return BackOffUtils.next(sleeper, backOff);
      } catch (InterruptedException exception) {
        // ignore
      }
    }
    return false;
  }
976494
@Override
    public void handle(T result, HttpResponse response) {
        String restoreHeader = response.getHeaders().get(Headers.RESTORE);
        if (restoreHeader != null) {
            result.setRestoreExpirationTime(parseDate(restoreHeader));
            Boolean onGoingRestore = parseBoolean(restoreHeader);
            if (onGoingRestore != null) {
                result.setOngoingRestore(onGoingRestore);
            }
        }
    }
772030
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext) {
        request.setEndpoint(endpoint);
        request.setTimeOffset(timeOffset);

        HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());

        return client.execute(request, responseHandler, errorResponseHandler, executionContext);
    }
838992
@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {

        String url = this.getURL(req);

        LOGGER.debug("Started processing request : {}", url);

        List<String> resourcesToMerge = findResourcesToMerge(req.getContextPath(), url);
        String extensionOrPath = detectExtension(url);//in case of non js/css files it null
        if (extensionOrPath.isEmpty()) {
            extensionOrPath = resourcesToMerge.get(0);//non grouped i.e. non css/js file, we refer it's path in that case
        }

        //If not modified, return 304 and stop
        ResourceStatus status = JSCSSMergeServlet.isNotModified(this.getServletContext(), req, resourcesToMerge, this.turnOffETag);
        if (status.isNotModified()) {
            LOGGER.trace("Resources Not Modified. Sending 304.");
            String ETag = !this.turnOffETag ? status.getActualETag() : null;
            JSCSSMergeServlet.sendNotModified(resp, extensionOrPath, ETag, this.expiresMinutes, this.cacheControl, this.overrideExistingHeaders);
            return;
        }


        //Add appropriate headers
        this.addAppropriateResponseHeaders(extensionOrPath, resourcesToMerge, status.getActualETag(), resp);

        OutputStream outputStream = resp.getOutputStream();
        String contextPathForCss = customContextPathForCSSUrls != null ?
                customContextPathForCSSUrls : req.getContextPath();
        ProcessedResult processedResult = this.processResources(contextPathForCss, outputStream, resourcesToMerge);
        int resourcesNotFound = processedResult.getNumberOfMissingResources();

        if (resourcesNotFound > 0 && resourcesNotFound == resourcesToMerge.size()) { //all resources not found
            resp.sendError(HttpServletResponse.SC_NOT_FOUND);
            LOGGER.warn("All resources are not found. Sending 404.");
            return;
        }
        if (outputStream != null) {
            try {
                resp.setStatus(HttpServletResponse.SC_OK);
                outputStream.close();
            } catch (Exception e) {
                // ignore
            }
        }
        resp.setHeader("Content-Length", String.valueOf(processedResult.contentLength));
        LOGGER.debug("Finished processing Request : {}", url);
    }
1182001
function (req, res, next) {
        var ip = IPAddressHelper.getClientIP(req)
            , route = req.miajs.route
            , key = ip + route.path + route.method;

        if (_.isEmpty(route.rateLimits)) {
            next();
            return;
        }

        RateLimiter.checkRateLimitsByKey(key, route.rateLimits).then(function (rateLimiterResult) {
            if (rateLimiterResult.remaining == -1) {
                _logInfo("Rate limit of " + rateLimiterResult.limit + "req/" + rateLimiterResult.timeInterval + "min requests exceeded " + route.requestmethod.toUpperCase() + " " + route.url + " for " + ip);
                res.header("X-Rate-Limit-Limit", rateLimiterResult.limit);
                res.header("X-Rate-Limit-Remaining", 0);
                res.header("X-Rate-Limit-Reset", rateLimiterResult.timeTillReset);
                next(new MiaError({
                    status: 429,
                    err: {
                        'code': 'RateLimitExceeded',
                        'msg': Translator('system', 'RateLimitExceeded')
                    }
                }));
            }
            else {
                res.header("X-Rate-Limit-Limit", rateLimiterResult.limit);
                res.header("X-Rate-Limit-Remaining", rateLimiterResult.remaining);
                res.header("X-Rate-Limit-Reset", rateLimiterResult.timeTillReset);
                next();
            }
        }).catch(function () {
            next();
        });
    }
801861
def rate_limits(self):
        """"""
        if not self._rate_limits:
            self._rate_limits = utilities.get_rate_limits(self.response)

        return self._rate_limits
894502
def process_request(self, req, resp):
        

        key = req.env['REMOTE_PORT'] + req.env['REMOTE_ADDR']
        val = self.cache.get(key, 0)

        if val == self.count:
            abort(exceptions.TooManyRequests(headers=self._error_headers))
        else:
            self.cache[key] = val + 1
490517
public function processSapiRequest()
    {
        $http = $this->builder->components()->http();
        $serverRequest = $http->sapiServerRequest();

        $response = $this->processor()->process($serverRequest);

        $http->output(
            $response,
            $this->builder->context()->httpContext()
        );
    }
1016826
def process_request(self, request_object):
        """"""
        resources = (request_object.entity_cls.query
                     .filter(**request_object.filters)
                     .offset((request_object.page - 1) * request_object.per_page)
                     .limit(request_object.per_page)
                     .order_by(request_object.order_by)
                     .all())
        return ResponseSuccess(Status.SUCCESS, resources)
809665
def rate_limit(client, headers, atexit=False):
    """"""
    if not client or not headers:
        return False

    if not getattr(client.config, "rate_limit", False):
        return False

    rate_info = RateLimitsInfo.from_headers(headers)
    if not rate_info or not rate_info.interval:
        return False

    if rate_info.interval:
        cb = getattr(client.config, "rate_limit_callback", None)
        if cb and callable(cb):
            cb(rate_info, atexit=atexit)
        time.sleep(rate_info.interval)
    return True
1333120
def is_rate_limit_exceeded(self):
        """"""
        history = self.get_history()
        if history.amount_api_calls >= settings.UNSHORTEN_DAILY_LIMIT:
            return True
        return False