more meaningful variable naming

This commit is contained in:
Hossein Shafagh 2020-10-30 18:18:37 -07:00
parent e1ff89eb2d
commit add0960579
1 changed files with 6 additions and 6 deletions

View File

@ -44,15 +44,15 @@ def put(bucket_name, region_name, prefix, data, encrypt, **kwargs):
@sts_client("s3", service_type="client") @sts_client("s3", service_type="client")
def delete(bucket_name, prefix, **kwargs): def delete(bucket_name, prefixed_object_name, **kwargs):
""" """
Use STS to delete an object Use STS to delete an object
""" """
try: try:
response = kwargs["client"].delete_object(Bucket=bucket_name, Key=prefix) response = kwargs["client"].delete_object(Bucket=bucket_name, Key=prefixed_object_name)
current_app.logger.debug(f"Delete data from S3." current_app.logger.debug(f"Delete data from S3."
f"Bucket: {bucket_name}," f"Bucket: {bucket_name},"
f"Prefix: {prefix}," f"Prefix: {prefixed_object_name},"
f"Status_code: {response}") f"Status_code: {response}")
return response['ResponseMetadata']['HTTPStatusCode'] < 300 return response['ResponseMetadata']['HTTPStatusCode'] < 300
except ClientError: except ClientError:
@ -61,14 +61,14 @@ def delete(bucket_name, prefix, **kwargs):
@sts_client("s3", service_type="client") @sts_client("s3", service_type="client")
def get(bucket_name, prefix, **kwargs): def get(bucket_name, prefixed_object_name, **kwargs):
""" """
Use STS to get an object Use STS to get an object
""" """
try: try:
response = kwargs["client"].get_object(Bucket=bucket_name, Key=prefix) response = kwargs["client"].get_object(Bucket=bucket_name, Key=prefixed_object_name)
current_app.logger.debug(f"Get data from S3. Bucket: {bucket_name}," current_app.logger.debug(f"Get data from S3. Bucket: {bucket_name},"
f"Prefix: {prefix}") f"object_name: {prefixed_object_name}")
return response['Body'].read().decode("utf-8") return response['Body'].read().decode("utf-8")
except ClientError: except ClientError:
sentry.captureException() sentry.captureException()