Project: google-events

Google Cloudevents library

Project Details

Latest version
0.11.0
Home Page
https://github.com/googleapis/google-cloudevents-python/
PyPI Page
https://pypi.org/project/google-events/

Project Popularity

PageRank
0.0027688834213959474
Number of downloads
97876

Google CloudEvents - Python

PyPI version

This library provides classes of common event types used with Google services, as defined in the Google Cloudevents repository.

Installation and Usage

Note: This library requires Python 3.7+.

To install this package, run

pip install --upgrade google-events

To use an event class, see the snippet below:

from google.events.cloud import storage

# Parses a json string containing an event payload
# The json payload may be from an HTTP request received by a Cloud Run
# service with event triggers.

def handle_event_trigger(json_payload):
    event = storage.StorageObjectData.from_json(json_payload)
    print(f"{event.bucket}/{event.name} had event")
    return "OK"