From 1a516bfe3c38d1783b8de52bc027c3516e150e88 Mon Sep 17 00:00:00 2001 From: Charles Moore <122481442+moorec-aws@users.noreply.github.com> Date: Tue, 19 Sep 2023 13:43:34 -0500 Subject: [PATCH] fix: download service model (#16) Signed-off-by: Charles Moore <> --- src/deadline_test_fixtures/fixtures.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/deadline_test_fixtures/fixtures.py b/src/deadline_test_fixtures/fixtures.py index f93c306..983a937 100644 --- a/src/deadline_test_fixtures/fixtures.py +++ b/src/deadline_test_fixtures/fixtures.py @@ -144,15 +144,13 @@ def service_model() -> Generator[ServiceModel, None, None]: LOG.info(f"Downloading {service_model_s3_uri}") s3_obj = S3Object.from_uri(service_model_s3_uri) s3_client = boto3.client("s3") - response = call_api( - description=f"Downloading {service_model_s3_uri}", - fn=lambda: s3_client.get_object(Bucket=s3_obj.bucket, Key=s3_obj.key), - ) with tempfile.TemporaryDirectory() as tmpdir: json_path = os.path.join(tmpdir, "service-2.json") - with open(json_path, mode="w") as f: - f.write(response["Body"].read()) + call_api( + description=f"Downloading {service_model_s3_uri}", + fn=lambda: s3_client.download_file(s3_obj.bucket, s3_obj.key, json_path), + ) yield ServiceModel.from_json_file(json_path) else: if not local_model_path: