Skip to content

Commit

Permalink
fix: Use client syntax for getting file contents (#1194)
Browse files Browse the repository at this point in the history
### Motivation

Missing update from #1172.

### Verification

Untested
  • Loading branch information
l0b0 authored Nov 28, 2024
1 parent 8d47490 commit ab83041
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/aws/aws_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

if TYPE_CHECKING:
from mypy_boto3_s3 import S3Client
from mypy_boto3_s3.type_defs import GetObjectOutputTypeDef
else:
GetObjectOutputTypeDef = dict
S3Client = dict

S3Path = NamedTuple("S3Path", [("bucket", str), ("key", str)])
Expand All @@ -33,8 +35,8 @@ def _init_roles() -> None:
"""Load bucket to roleArn mapping for LINZ internal buckets from SSM"""
s3_client: S3Client = session.client("s3")
bucket, key = parse_path(bucket_config_path)
content_object = s3_client.Object(bucket, key)
file_content = content_object.get()["Body"].read().decode("utf-8")
content_object: GetObjectOutputTypeDef = s3_client.get_object(Bucket=bucket, Key=key)
file_content = content_object["Body"].read().decode("utf-8")
json_content = json.loads(file_content)

get_log().trace("bucket_config_load", config=bucket_config_path)
Expand Down

0 comments on commit ab83041

Please sign in to comment.