Skip to main content

Some utilties to work with Google Firestore API.

Project description

Some utilties to work with Google Firestore API.

First utility is firegorest.tidy_doc, to make a neat data dictionary from the event passed by Google Cloud runtime to your cloud function.

Install

pip install firegorest

Example

from logbook import Logger
from firegorest import tidy_doc
from firegorest.types import GCFContext

logger = Logger(__name__)


def act_on_customer_change(event: dict, context: GCFContext):
    try:
        logger.info('Old Value: {}', tidy_doc(event['oldValue']['fields']))
    except KeyError:
        pass
    try:
        logger.info('New Value: {}', tidy_doc(event['value']['fields']))
    except KeyError:
        pass
    resource = context.resource
    logger.debug('Resource: {}', resource)
    return True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firegorest-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

firegorest-0.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page