-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use Requests.iter_lines to fix #176 #184
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
Conversation
The previous code had a bug in which it assumed that the chunk data had no newlines in it. In 0.9.0 newlines were added to the stream results, which exposed this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 32 chunk_size is because request will block until the chunk size is read. The default is 512, so if your status is currently less than 512 length, you will get no content. If your reading the response to get progress updates, you want a smaller chunk_size. Setting to 1 would ensure that you get pretty close to real time status updates, but then you'll be looping a lot more.
Nice! I'm going to close my pull request. |
Use Requests.iter_lines to fix #176
Awesome, thanks! |
Is there any chance of doing a bugfix release for this? It would be awesome for |
/cc @shin- |
I'd also appreciate a release for this. I'm disabling certain functionality in my app because I can't use pull(stream=True). |
0.3.1 should make it to pypi shortly. Sorry for the delay guys. |
Docker introduced newlines in stream output in version 0.9 (moby/moby#4276), but not to all endpoints - POST /images/create, for example, does not include them. This reverts to the old, less pleasant implementation of _stream_helper(), with a manual check for newlines to fix the problem described in docker#176 and fixed in docker#184, without the accompanying regression. It should work against Docker 0.8, 0.9 and 0.10, both when building and when pulling.
Docker introduced newlines in stream output in version 0.9 (moby/moby#4276), but not to all endpoints - POST /images/create, for example, does not include them. This reverts to the old, less pleasant implementation of _stream_helper(), with a manual check for newlines to fix the problem described in docker#176 and fixed in docker#184, without the accompanying regression. It should work against Docker 0.8, 0.9 and 0.10, both when building and when pulling.
Docker introduced newlines in stream output in version 0.9 (moby/moby#4276), but not to all endpoints - POST /images/create, for example, does not include them. This reverts to the old, less pleasant implementation of _stream_helper(), with a manual check for newlines to fix the problem described in docker#176 and fixed in docker#184, without the accompanying regression. It should work against Docker 0.8, 0.9 and 0.10, both when building and when pulling.
Two changes are made in the PR.
No tests are added in this PR because the existing integration tests were already failing against 0.9.0. This PR makes all integration tests succeed again.
Fixes #176