Push events to pubsub.

This commit is contained in:
Tom Alexander
2021-07-20 23:26:14 -04:00
parent f457cf2a6c
commit 7bf8370650
4 changed files with 19 additions and 1 deletions

View File

@@ -1,8 +1,14 @@
import json
import os
from google.cloud import pubsub_v1
publisher = pubsub_v1.PublisherClient()
topic = publisher.topic_path(os.environ.get("GCP_PROJECT"), os.environ.get("GCP_TOPIC"))
def push_to_pubsub(request_params):
print(json.dumps(request_params))
publisher.publish(topic, json.dumps(request_params).encode("utf-8")).result()
def main(request):

View File

@@ -1 +1,2 @@
Flask==1.1.2
google-cloud-pubsub==2.6.1