How to use the keen.utilities.KeenKeys.MASTER function in keen

To help you get started, we’ve selected a few keen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keenlabs / KeenClient-Python / keen / cached_datasets.py View on Github external
    @requires_key(KeenKeys.MASTER)
    def create(self, dataset_name, query, index_by, display_name):
        """ Create a Cached Dataset for a Project. Master key must be set.
        """
        url = "{0}/{1}".format(self._cached_datasets_url, dataset_name)
        payload = {
            "query": query,
            "index_by": index_by,
            "display_name": display_name
        }
        return self._get_json(HTTPMethods.PUT, url, self._get_master_key(), json=payload)
github keenlabs / KeenClient-Python / keen / utilities.py View on Github external
def method_wrapper(self, *args, **kwargs):
            for case in switch(key_type):
                if case(KeenKeys.READ):
                    if not self._get_read_key():
                        _throw_key_missing(KeenKeys.READ, bool(self._get_master_key()))
                    break

                if case(KeenKeys.WRITE):
                    if not self._get_write_key():
                        _throw_key_missing(KeenKeys.WRITE, bool(self._get_master_key()))
                    break

                if case(KeenKeys.MASTER):
                    if not self._get_master_key():
                        _throw_key_missing(KeenKeys.MASTER, False)
                    break

            return func(self, *args, **kwargs)
github keenlabs / KeenClient-Python / keen / api.py View on Github external
    @requires_key(KeenKeys.MASTER)
    def update_access_key_name(self, access_key_id, name):
        """
        Updates only the name portion of an access key.

        :param access_key_id: the 'key' value of the access key to change the name of
        :param name: the new name to give this access key
        """
        return self._update_access_key_pair(access_key_id, "name", name)
github keenlabs / KeenClient-Python / keen / saved_queries.py View on Github external
    @requires_key(KeenKeys.MASTER)
    def get(self, query_name):
        """
        Gets a single saved query for a project from the Keen IO API given a
        query name.
        Master key must be set.
        """

        url = "{0}/{1}".format(self.saved_query_url, query_name)
        response = self._get_json(HTTPMethods.GET, url, self._get_master_key())

        return response
github keenlabs / KeenClient-Python / keen / utilities.py View on Github external
def method_wrapper(self, *args, **kwargs):
            for case in switch(key_type):
                if case(KeenKeys.READ):
                    if not self._get_read_key():
                        _throw_key_missing(KeenKeys.READ, bool(self._get_master_key()))
                    break

                if case(KeenKeys.WRITE):
                    if not self._get_write_key():
                        _throw_key_missing(KeenKeys.WRITE, bool(self._get_master_key()))
                    break

                if case(KeenKeys.MASTER):
                    if not self._get_master_key():
                        _throw_key_missing(KeenKeys.MASTER, False)
                    break

            return func(self, *args, **kwargs)