-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boto3 S3 StreamingBody().read() reads once and returns nothing after that #564
Comments
The class is described here. We will look to see if we can get this ported over or linked in the boto3 docs. As seen in the docs, if you call There is also no |
Is there any particular reason that this is still an open ticket? |
Is there a reason why the StreamingBody, is not seekable? |
@danielmorozoff 'get_object' supports a range parameter. client.get_object(Bucket=bucket, Key=key, Range='bytes={}-{}'.format(amount_read, amount_read + chunk_size)) |
One way to allow See: https://github.com/boto/botocore/blob/master/botocore/response.py#L42 |
is there any work around to use seek in StreamBody? |
I solved this by using
|
@ryanermita I was thinking in a way to seek and not putting the whole file in memory. If you have no problem in filling the memory with the file, a cleaner way is to just |
I will try this one, thank you @alanjds 👍 |
Has it been suggested to change the botocore.streambody? I ran into this issue twice. (the second time was because I haven't used read() on the object in a while. Even the documentation you linked to doesn't make it clear to me that the stream gets flushed after the first read. It'd be more intuitive if the stream was copied when read instead of flushed. |
I found a solution that worked for me. It involves writing a wrapper that supports |
If someone is having the problem
|
complete bytes removed for brevity. I get an object, and read it. Then I read it again, but no bytes are returned.
If this stream acts as a normal file IO stream, how can I seek to the beginning of the stream? seek() does not seem to be a method on the streamingBody object.
The text was updated successfully, but these errors were encountered: