Skip to content

Commit

Permalink
Added POST request handling as part of v1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-lu authored Sep 24, 2024
1 parent af0b040 commit f6aa6c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rcs-harvest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def handle_request(event, context):

def handle_post_request(event, viewer_configuration_table):
message = ""

try:
# Check if the body is Base64 encoded
if isinstance(event["body"], str):
Expand All @@ -53,11 +54,11 @@ def handle_post_request(event, viewer_configuration_table):
else:
raise ValueError("Invalid body format")

print("json_data: ", json_data)
#print("json_data: ", json_data)
if isinstance(json_data, str):
json_data = json.loads(json_data) # Parsing if it's a string
gcs_data = json_data["body"]["gcs"] # Extracting 'gcs' from the body
print("gcs_data: ", gcs_data)
#print("gcs_data: ", gcs_data)
except (KeyError, json.JSONDecodeError, ValueError):
message += "json_data was not supplied or is invalid"
return {
Expand Down Expand Up @@ -256,4 +257,4 @@ def is_base64_encoded(data):

def nonesafe_loads(obj):
if obj is not None:
return json.loads(obj)
return json.loads(obj)

0 comments on commit f6aa6c5

Please sign in to comment.