How to use the gkeepapi.exception.InvalidException function in gkeepapi

To help you get started, we’ve selected a few gkeepapi 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 kiwiz / gkeepapi / gkeepapi / __init__.py View on Github external
def add(self, node):
        """Register a top level node (and its children) for syncing up to the server. There's no need to call this for nodes created by
        :py:meth:`createNote` or :py:meth:`createList` as they are automatically added.

            LoginException: If :py:meth:`login` has not been called.
        Args:
            node (gkeepapi.node.Node): The node to sync.

        Raises:
            Invalid: If the parent node is not found.
        """
        if node.parent_id != _node.Root.ID:
            raise exception.InvalidException('Not a top level node')

        self._nodes[node.id] = node
        self._nodes[node.parent_id].append(node, False)
github kiwiz / gkeepapi / gkeepapi / node.py View on Github external
def add(self, text, checked=False, sort=None):
        """Add a new sub item to the list. This item must already be attached to a list.

        Args:
            text (str): The text.
            checked (bool): Whether this item is checked.
            sort (int): Item id for sorting.
        """
        if self.parent is None:
            raise exception.InvalidException('Item has no parent')
        node = self.parent.add(text, checked, sort)
        self.indent(node)
        return node