From 91e1640697c8e45ecb43ab0ff105eab3a2619046 Mon Sep 17 00:00:00 2001 From: brmnjsh Date: Fri, 8 Sep 2023 12:51:37 +0200 Subject: [PATCH 1/2] Update app/main.py Co-authored-by: Owen <84334068+owenhtr@users.noreply.github.com> --- app/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/main.py b/app/main.py index f0f3580..ff2cc6f 100644 --- a/app/main.py +++ b/app/main.py @@ -28,7 +28,6 @@ class ServiceListener(Consumer): # but depending on if we can add the tagset to the sqs message body # we either extract that and then delegate to the appropriate service # or get the action tag from the object through the aws helper function - # service = None key = aws_helper.get_key_from_message(body) bucket = aws_helper.get_bucket_from_message(body) action = aws_helper.get_object_tag(key, bucket, 'action')['Value'] From 2ae15f923756575ab93bd3c11bb8a52dedf7d92a Mon Sep 17 00:00:00 2001 From: brmnjsh Date: Fri, 8 Sep 2023 15:51:42 +0000 Subject: [PATCH 2/2] enumerate --- app/helpers/aws_helper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/helpers/aws_helper.py b/app/helpers/aws_helper.py index cfcf7f6..cccda41 100644 --- a/app/helpers/aws_helper.py +++ b/app/helpers/aws_helper.py @@ -31,10 +31,9 @@ def get_object(key: str, bucket: str) -> bytes: def get_object_tag(key: str, bucket: str, tag_key: str) -> Union[str, None]: tags = get_object_tags(key, bucket) - tag_index = 0 - while tag_index < len(tags): - tag = tags[tag_index] + for i, tag in enumerate(tags): + tag = tags[i] if tag['Key'] == tag_key: return tag else: