Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
fix(botocore): S3 operations formatting failure (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagivr2020 committed Jun 8, 2022
1 parent 4b4ddb7 commit 58a6168
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions epsagon/events/botocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def __init__(self, wrapped, instance, args, kwargs, start_time, response,

_, request_data = args
self.resource['name'] = request_data['Bucket']

if self.resource['operation'] in \
['HeadObject', 'GetObject', 'PutObject']:
self.resource['metadata']['key'] = request_data['Key']
Expand All @@ -237,7 +236,6 @@ def update_response(self, response):
:return: None
"""
super(BotocoreS3Event, self).update_response(response)

if self.resource['operation'] == 'ListObjects':
files = [
[str(x['Key']).strip('"'), x['Size'], x['ETag']]
Expand All @@ -251,12 +249,12 @@ def update_response(self, response):
self.resource['metadata']['etag'] = response['ETag'].strip('"')
self.resource['metadata']['file_size'] = response['ContentLength']
self.resource['metadata']['last_modified'] = \
response['LastModified'].strftime('%s')
response['LastModified'].strftime('%S')
elif self.resource['operation'] == 'GetObject':
self.resource['metadata']['etag'] = response['ETag'].strip('"')
self.resource['metadata']['file_size'] = response['ContentLength']
self.resource['metadata']['last_modified'] = \
response['LastModified'].strftime('%s')
response['LastModified'].strftime('%S')


class BotocoreKinesisEvent(BotocoreEvent):
Expand Down

0 comments on commit 58a6168

Please sign in to comment.