From 5347da6cb3e8cddb306b095eb55c5c343b99fdf8 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 23 May 2024 13:43:36 -0700 Subject: [PATCH 1/2] Incorporate latest changes to v2 upload interface --- felt/core/map_uploader.py | 4 +--- felt/core/s3_upload_parameters.py | 35 ++++++++++--------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/felt/core/map_uploader.py b/felt/core/map_uploader.py index 8b3d335..42389e0 100644 --- a/felt/core/map_uploader.py +++ b/felt/core/map_uploader.py @@ -494,9 +494,7 @@ def _upload_progress(sent, total): if self.isCanceled(): return False - layer_id = upload_details.get('data', {}).get('attributes', - {}).get( - 'first_layer_id') + layer_id = upload_details.get('layer_id') if details.style and details.style.fsl is not None: if not layer_id: Logger.instance().log_error_json( diff --git a/felt/core/s3_upload_parameters.py b/felt/core/s3_upload_parameters.py index d5bf15f..15ef7c9 100644 --- a/felt/core/s3_upload_parameters.py +++ b/felt/core/s3_upload_parameters.py @@ -50,28 +50,15 @@ def from_json(res: str) -> 'S3UploadParameters': """ return S3UploadParameters( type=res.get('data', {}).get('type'), - aws_access_key_id=res.get('data', {}).get('attributes', {}).get( - 'presigned_attributes', {}).get('AWSAccessKeyId'), - acl=res.get('data', {}).get('attributes', {}).get( - 'presigned_attributes', {}).get('acl'), - key=res.get('data', {}).get('attributes', {}).get( - 'presigned_attributes', {}).get('key'), - policy=res.get('data', {}).get('attributes', {}).get( - 'presigned_attributes', {}).get('policy'), - signature=res.get('data', {}).get('attributes', {}).get( - 'presigned_attributes', {}).get('signature'), - success_action_status=res.get('data', {}).get('attributes', - {}).get( - 'presigned_attributes', {}).get('success_action_status'), - x_amz_meta_features_flags=res.get('data', {}).get('attributes', - {}).get( - 'presigned_attributes', {}).get('x-amz-meta-feature-flags'), - x_amz_meta_file_count=res.get('data', {}).get('attributes', - {}).get( - 'presigned_attributes', {}).get('x-amz-meta-file-count'), - x_amz_security_token=res.get('data', {}).get('attributes', - {}).get( - 'presigned_attributes', {}).get('x-amz-security-token'), - url=res.get('data', {}).get('attributes', {}).get('url'), - layer_id=res.get('data', {}).get('attributes', {}).get('layer_id'), + aws_access_key_id=res.get('presigned_attributes', {}).get('AWSAccessKeyId'), + acl=res.get('presigned_attributes', {}).get('acl'), + key=res.get('presigned_attributes', {}).get('key'), + policy=res.get('presigned_attributes', {}).get('policy'), + signature=res.get('presigned_attributes', {}).get('signature'), + success_action_status=res.get('presigned_attributes', {}).get('success_action_status'), + x_amz_meta_features_flags=res.get('presigned_attributes', {}).get('x-amz-meta-feature-flags'), + x_amz_meta_file_count=res.get('presigned_attributes', {}).get('x-amz-meta-file-count'), + x_amz_security_token=res.get('presigned_attributes', {}).get('x-amz-security-token'), + url=res.get('url'), + layer_id=res.get('layer_id'), ) From 28c8cd0d1a8ba9211bf20712c62adb74a37c145e Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 23 May 2024 13:47:11 -0700 Subject: [PATCH 2/2] lint fixes --- felt/core/s3_upload_parameters.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/felt/core/s3_upload_parameters.py b/felt/core/s3_upload_parameters.py index 15ef7c9..0a70e30 100644 --- a/felt/core/s3_upload_parameters.py +++ b/felt/core/s3_upload_parameters.py @@ -50,15 +50,20 @@ def from_json(res: str) -> 'S3UploadParameters': """ return S3UploadParameters( type=res.get('data', {}).get('type'), - aws_access_key_id=res.get('presigned_attributes', {}).get('AWSAccessKeyId'), + aws_access_key_id=res.get('presigned_attributes', {}).get( + 'AWSAccessKeyId'), acl=res.get('presigned_attributes', {}).get('acl'), key=res.get('presigned_attributes', {}).get('key'), policy=res.get('presigned_attributes', {}).get('policy'), signature=res.get('presigned_attributes', {}).get('signature'), - success_action_status=res.get('presigned_attributes', {}).get('success_action_status'), - x_amz_meta_features_flags=res.get('presigned_attributes', {}).get('x-amz-meta-feature-flags'), - x_amz_meta_file_count=res.get('presigned_attributes', {}).get('x-amz-meta-file-count'), - x_amz_security_token=res.get('presigned_attributes', {}).get('x-amz-security-token'), + success_action_status=res.get('presigned_attributes', {}).get( + 'success_action_status'), + x_amz_meta_features_flags=res.get('presigned_attributes', {}).get( + 'x-amz-meta-feature-flags'), + x_amz_meta_file_count=res.get('presigned_attributes', {}).get( + 'x-amz-meta-file-count'), + x_amz_security_token=res.get('presigned_attributes', {}).get( + 'x-amz-security-token'), url=res.get('url'), layer_id=res.get('layer_id'), )