Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Content Range header not returned when requested range is 'bytes=0-' #754

Closed
nicoandra opened this issue Jun 14, 2021 · 1 comment
Closed

Comments

@nicoandra
Copy link
Contributor

Had some trouble using this library with smart_open

See the snippet below, where I hit both a real S3 implementation and the S3rver implementation:

## Install dependencies:
pip install smart-open

Code

from boto3.session import Session
from smart_open import open

def create_s3_client_real(): 
    client = Session(
        aws_access_key_id="KEY", 
        aws_secret_access_key="SECRET"
    ).client( "s3", )
    return client

def create_s3_client_s3rver(): 
    client = Session(
        aws_access_key_id="S3RVER", 
        aws_secret_access_key="S3RVER"
    ).client("s3", endpoint_url="http://localhost:4569")
    return client

real = create_s3_client_real()
s3rver = create_s3_client_s3rver()

print(real.get_object(Bucket="bucket", Key="object.txt", Range="bytes=0-")) 
print(" *********************** ") 
print(s3rver.get_object(Bucket="bucket", Key="object.txt", Range="bytes=0-"))

The problem arises because the check if(options.start || options.end) evaluates to false when options.start = 0; however it is a valid range.

A Pull Request has been submitted: #753

@kherock
Copy link
Collaborator

kherock commented Oct 3, 2021

Closed via #755 and released in v3.7.1!

@kherock kherock closed this as completed Oct 3, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants