How to use the gkeepapi.node 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 Nekmo / gkeep / google_keep_tasks / notes.py View on Github external
# -*- coding: utf-8 -*-
import click
import gkeepapi
import sys

from google_keep_tasks.exceptions import InvalidColor
from google_keep_tasks.management import cli


COLORS = {
    gkeepapi.node.ColorValue.Gray: {'bg': 'black', 'fg': 'white'},
    gkeepapi.node.ColorValue.Red: {'bg': 'red', 'fg': 'white'},
    gkeepapi.node.ColorValue.Green: {'bg': 'green'},
    gkeepapi.node.ColorValue.Yellow: {'bg': 'green', 'fg': 'black'},
    gkeepapi.node.ColorValue.Blue: {'bg': 'cyan', 'fg': 'white'},
    gkeepapi.node.ColorValue.DarkBlue: {'bg': 'blue', 'fg': 'white'},
    gkeepapi.node.ColorValue.Purple: {'bg': 'magenta', 'fg': 'white'},
    gkeepapi.node.ColorValue.White: {'bg': 'white', 'fg': 'black'},
}


def get_color(color):
    if not color:
        return
    color = color.title()
    if color and not hasattr(gkeepapi.node.ColorValue, color):
        raise InvalidColor(color)
    return getattr(gkeepapi.node.ColorValue, color)
github kiwiz / gkeepapi / gkeepapi / __init__.py View on Github external
# Hydrate labels.
            if 'userInfo' in changes:
                self._parseUserInfo(changes['userInfo'])

            # Hydrate notes and any children.
            if 'nodes' in changes:
                self._parseNodes(changes['nodes'])

            self._keep_version = changes['toVersion']
            logger.debug('Finishing sync: %s', self._keep_version)

            # Check if there are more changes to retrieve.
            if not changes['truncated']:
                break

        if _node.DEBUG:
            self._clean()