Skip to content

Commit

Permalink
fix: try new library
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Jan 2, 2024
1 parent ad83275 commit 6378ddd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions cloudrun/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"google-cloud-logging==3.*",
"google-cloud-storage==2.*",
"google-cloud-firestore==2.*",
"google-events==0.*",
"flask-cors==4.*",
"flask-json==0.4",
"flask==3.*",
Expand Down
12 changes: 5 additions & 7 deletions cloudrun/src/download/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import threading
import traceback
from os import environ
import json

from cloudevents.http import from_http
from dotenv import load_dotenv
from flask import Flask, request
from flask_cors import CORS
from flask_json import FlaskJSON
from google.events.cloud import firestore

load_dotenv() # this needs to be called before importing any other local modules

Expand Down Expand Up @@ -38,14 +38,12 @@ def process_job():
Kicked off by eventarc event triggered when a new document is added to firestore
"""
event = from_http(request.headers, request.get_data())
#: TODO: check what the this event object looks like
# 44 is throwing a keyerror on "value"
log.logger.info(f"request.get_data(): {request.get_data()}")
log.logger.info(f"dir(event): {dir(event)}")
log.logger.info(f"event.get_data(): {event.get_data()}")
log.logger.info(f"event.get_attributes(): {event.get_attributes()}")
log.logger.info(f"event.data: {event.data}")
data = json.dumps(event.get_data())
#: todo, figure out how to parse the event data, it's binary protobuf
document = firestore.DocumentEventData(event.get_data())
log.logger.info(f"dir(document): {dir(document)}")
data = document.value

id = data["id"]
layers = data["layers"]
Expand Down

0 comments on commit 6378ddd

Please sign in to comment.