Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions openc3/lib/openc3/utilities/aws_bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ def delete(bucket)
end
end

def get_object(bucket:, key:, path: nil)
def get_object(bucket:, key:, path: nil, range: nil)
if path
@client.get_object(bucket: bucket, key: key, response_target: path)
@client.get_object(bucket: bucket, key: key, response_target: path, range: range)
else
@client.get_object(bucket: bucket, key: key)
@client.get_object(bucket: bucket, key: key, range: range)
end
# If the key is not found return nil
rescue Aws::S3::Errors::NoSuchKey
Expand Down
2 changes: 1 addition & 1 deletion openc3/lib/openc3/utilities/bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def delete(bucket)
raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

def get_object(bucket:, key:, path: nil)
def get_object(bucket:, key:, path: nil, range: nil)
raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

Expand Down
6 changes: 3 additions & 3 deletions openc3/python/openc3/utilities/aws_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ def delete(self, bucket):
if self.exist(bucket):
self.client.delete_bucket(Bucket=bucket)

def get_object(self, bucket, key, path=None):
def get_object(self, bucket, key, path=None, range=""):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should range = "" or None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing Range=None to python Boto3 causes an error, so defaulting to a string here

try:
if path:
response = self.client.get_object(Bucket=bucket, Key=key)
response = self.client.get_object(Bucket=bucket, Key=key, Range=range)
with open(path, "wb") as f:
f.write(response["Body"].read())
return response
else:
return self.client.get_object(Bucket=bucket, Key=key)
return self.client.get_object(Bucket=bucket, Key=key, Range=range)
# If the key is not found return nil
except ClientError:
return None
Expand Down
2 changes: 1 addition & 1 deletion openc3/python/openc3/utilities/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def delete(self, bucket):
f"{self.__class__.__name__} has not implemented method '{inspect.currentframe().f_code.co_name}'"
)

def get_object(self, bucket, key, path=None):
def get_object(self, bucket, key, path=None, range=""):
raise NotImplementedError(
f"{self.__class__.__name__} has not implemented method '{inspect.currentframe().f_code.co_name}'"
)
Expand Down
Loading