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


Release history Release notifications

Download files

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

Files for firegorest, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size firegorest-0.1.0-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size firegorest-0.1.0.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page