Get limits from the api key itself, database access is needed.
328135
public static UserLimits getLimitsByApiKey(HTTPServerConfig config, String username, String apiKey) {
    DatabaseAccess db = DatabaseAccess.getInstance();
    Long id = db.getUserId(username, apiKey);
    return new UserLimits(config.maxTextLengthWithApiKey, config.maxCheckTimeWithApiKeyMillis, id);
  }
1175814
def get_response(self, key, serializable=False):
        """"""
        range_request = self._build_get_range_request(
            key,
            serializable=serializable
        )

        return self.kvstub.Range(
            range_request,
            self.timeout,
            credentials=self.call_credentials,
            metadata=self.metadata
        )
123832
def get_rate_limits(self):
        
        resp, body = self.method_get("/limits")
        rate_limits = body.get("limits", {}).get("rate")
        ret = []
        for rate_limit in rate_limits:
            limits = rate_limit["limit"]
            uri_limits = {"uri": rate_limit["uri"],
                    "limits": limits}
            ret.append(uri_limits)
        return ret
799930
protected function getParams()
    {
        $keys = array();
        foreach (func_get_args() as $k) {
            if (is_string($k)) {
                $keys[] = $k;
            }
        }

        $params = $returnedParams = Input::all();

        list($offset, $limit) = $this->apiOffsetLimit();
        $params['offset'] = $offset;
        $params['limit']  = $limit;

        if (Input::has('includes') && is_array(Input::get('includes'))) {
            $params['includes'] = (array) Input::get('includes');
        }

        /*
         * Clean
         */
        if (!empty($key) && !empty($params)) {
            $returnedParams = array();

            foreach ($params as $key => $value) {
                if (in_array($key, $keys)) {
                    $returnedParams[$key] = $value;
                }
            }
        }

        return $returnedParams;
    }
390650
public FutureData<Limit> getLimit(String identity, String service) {
        FutureData<Limit> future = new FutureData<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/limit/" + service));
        Request request = config.http().
                GET(uri, new PageReader(newRequestCallback(future, new Limit(), config)));
        performRequest(future, request);
        return future;
    }
1166724
def get_limits(self):
        
        vals = self._hook_manager.call_hook('task_limits', course=self.get_course(), task=self, default=self._limits)
        return vals[0] if len(vals) else self._limits
1023918
def get_collectors(self, limit=1000, offset=0):
        
        options = {
            'limit': limit,
            'offset': offset,
        }
        request = requests.get(self.url, params=options, auth=self.auth)

        try:
            results = request.json()['collectors']
        except KeyError:
            results = request.json()
        except json.decoder.JSONDecodeError:
            results = []

        return results
446425
def _find_usage_api_keys(self):
        
        logger.debug('Finding usage for API Keys')
        key_count = 0
        paginator = self.conn.get_paginator('get_api_keys')
        for resp in paginator.paginate():
            key_count += len(resp['items'])
        self.limits['API keys per account']._add_current_usage(
            key_count, aws_type='AWS::ApiGateway::ApiKey'
        )
261939
def limits_hydrate(db, lims):
    

    return [limits.Limit.hydrate(db, lim) for lim in lims]
1275142
public static void getBufferLimits(WsByteBuffer[] buffers, int[] limits) {
        // Double check that the parameters are non null.
        if ((buffers != null) && (limits != null)) {
            // Loop through the buffers.
            // In case of errant parameters, protect from array out of bounds.
            for (int i = 0; i < buffers.length && i < limits.length; i++) {
                // Double check for null buffers.
                if (buffers[i] != null) {
                    // Save the limit.
                    limits[i] = buffers[i].limit();
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "getBufferLimits: buffer[" + i + "] limit of " + limits[i]);
                    }
                } else {
                    // When buffer is null, save a limit of 0.
                    limits[i] = 0;
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "getBufferLimits: null buffer[" + i + "] limit of " + limits[i]);
                    }
                }
            }
        }
    }
1165629
def load(self, key):
        

        # Turn the key into a BucketKey
        if isinstance(key, basestring):
            key = BucketKey.decode(key)

        # Make sure the uuids match
        if key.uuid != self.uuid:
            raise ValueError("%s is not a bucket corresponding to this limit" %
                             key)

        # If the key is a version 1 key, load it straight from the
        # database
        if key.version == 1:
            raw = self.db.get(str(key))
            if raw is None:
                return self.bucket_class(self.db, self, str(key))
            return self.bucket_class.hydrate(self.db, msgpack.loads(raw),
                                             self, str(key))

        # OK, use a BucketLoader
        records = self.db.lrange(str(key), 0, -1)
        loader = BucketLoader(self.bucket_class, self.db, self, str(key),
                              records)

        return loader.bucket
395705
function(key, callback) {
      api.search({
        key: key,
        limit: this.conf.CONST.SEARCH_LIMIT
      }, callback);
    }
1161552
def values(self, limit=None, page=None):
        
        return self.get(limit=limit, page=page).values()
1081511
def fetch(self, limit, offset=0):
        """"""
        self.limit = limit
        self.offset = offset
        return self
736987
def keys():
    """"""
    for admin in current_app.config['ADMIN_USERS']:
        try:
            db.get_db()  # init db on global app context
            keys = ApiKey.find_by_user(admin)
        except Exception as e:
            click.echo('ERROR: {}'.format(e))
        else:
            for key in keys:
                click.echo('{:40} {}'.format(key.key, key.user))
753452
def limit(self, limit):
        
        query = self._copy()
        query._limit = limit
        return query
82888
def _update_limits_from_api(self):
        
        logger.debug('Setting DirectoryService limits from API')
        self.connect()
        resp = self.conn.get_directory_limits()
        directory_limits = resp['DirectoryLimits']
        self.limits['CloudOnlyDirectories']._set_api_limit(
            directory_limits['CloudOnlyDirectoriesLimit']
        )
        self.limits['CloudOnlyMicrosoftAD']._set_api_limit(
            directory_limits['CloudOnlyMicrosoftADLimit']
        )
        self.limits['ConnectedDirectories']._set_api_limit(
            directory_limits['ConnectedDirectoriesLimit']
        )