From cb54f3ad1384ae6f4fe02bbad80d778abe6d6e6b Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 23 May 2024 14:51:03 -0700 Subject: [PATCH] Update v2 upload interaction to match late-breaking changes (#67) * Incorporate latest changes to v2 upload interface * lint fixes --- felt/core/map_uploader.py | 4 +--- felt/core/s3_upload_parameters.py | 40 +++++++++++++------------------ 2 files changed, 17 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..0a70e30 100644 --- a/felt/core/s3_upload_parameters.py +++ b/felt/core/s3_upload_parameters.py @@ -50,28 +50,20 @@ 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'), )