Skip to content

Commit

Permalink
added basic methods with category_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tsebastiani committed Feb 14, 2024
1 parent 3e3ee8e commit 37473b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

app = Flask(__name__)

telemetry_category: str = "telemetry_category"
request_id_param: str = "request_id"
remote_filename_param: str = "remote_filename"

Expand All @@ -21,8 +22,10 @@ def telemetry():
query_params = request.args
if request_id_param not in query_params.keys():
return Response("[bad request]: missing request_id param", status=400)

category_folder = query_params.get(telemetry_category)
folder_name = query_params.get(request_id_param)
if category_folder:
folder_name = f"{category_folder}/{folder_name}"
bucket_name = os.getenv("BUCKET_NAME")
if bucket_name is None:
return Response("BUCKET_NAME env variable not set", status=500)
Expand Down Expand Up @@ -58,7 +61,11 @@ def presigned_post():
return Response(
f"[bad request]: missing {remote_filename_param} query param", status=400
)

request_id = query_params[request_id_param]
if telemetry_category in query_params.keys():
request_id = f"{query_params[telemetry_category]}/{request_id}"

remote_filename = query_params[remote_filename_param]
s_three = boto3.client("s3")

Expand Down

0 comments on commit 37473b7

Please sign in to comment.