diff --git a/app/helpers/aws_helper.py b/app/helpers/aws_helper.py index cccda41..38eb4fe 100644 --- a/app/helpers/aws_helper.py +++ b/app/helpers/aws_helper.py @@ -31,13 +31,7 @@ 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) - - for i, tag in enumerate(tags): - tag = tags[i] - if tag['Key'] == tag_key: - return tag - else: - return None + return next((tag for tag in tags if tag['Key'] == tag_key), None) def get_object_tags(key: str, bucket: str) -> list: tags = s3.get_object_tagging(Bucket=bucket, Key=key)['TagSet']