Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

firebase functions python

# Here is a sample from https://cloud.google.com/functions/docs/calling/cloud-firestore#functions_firebase_firestore-python

import json
def hello_firestore(data, context):
    """ Triggered by a change to a Firestore document.
    Args:
        data (dict): The event payload.
        context (google.cloud.functions.Context): Metadata for the event.
    """
    trigger_resource = context.resource

    print('Function triggered by change to: %s' % trigger_resource)

    print('
Old value:')
    print(json.dumps(data["oldValue"]))

    print('
New value:')
    print(json.dumps(data["value"]))
 
PREVIOUS NEXT
Tagged: #firebase #functions #python
ADD COMMENT
Topic
Name
8+9 =