Skip to content

sunshine-tech/FireGoRest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FireGoRest

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

About

Some utilties to work with Google Firestore API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages