{"action":"created","issue":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/3364","repository_url":"https://api.github.com/repos/kennethreitz/requests","labels_url":"https://api.github.com/repos/kennethreitz/requests/issues/3364/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/requests/issues/3364/comments","events_url":"https://api.github.com/repos/kennethreitz/requests/issues/3364/events","html_url":"https://github.com/kennethreitz/requests/issues/3364","id":162499663,"number":3364,"title":"iter_content not chunking?","user":{"login":"coyotlinden","id":541830,"avatar_url":"https://avatars.githubusercontent.com/u/541830?v=3","gravatar_id":"","url":"https://api.github.com/users/coyotlinden","html_url":"https://github.com/coyotlinden","followers_url":"https://api.github.com/users/coyotlinden/followers","following_url":"https://api.github.com/users/coyotlinden/following{/other_user}","gists_url":"https://api.github.com/users/coyotlinden/gists{/gist_id}","starred_url":"https://api.github.com/users/coyotlinden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coyotlinden/subscriptions","organizations_url":"https://api.github.com/users/coyotlinden/orgs","repos_url":"https://api.github.com/users/coyotlinden/repos","events_url":"https://api.github.com/users/coyotlinden/events{/privacy}","received_events_url":"https://api.github.com/users/coyotlinden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-06-27T16:59:26Z","updated_at":"2016-06-27T20:30:24Z","closed_at":null,"body":"I have code which is practically identical to the quickstart code:\r\n\r\n```\r\n        with open(self.filename, 'wb') as fd:\r\n            for chunk in self.req.iter_content(self.chunk_size):\r\n                fd.write(chunk)\r\n                if self.progressbar:\r\n                    self.in_queue.put(len(chunk))\r\n```\r\n\r\nwhere the queue is read in another thread by the GUI object and updates the progress bar.  The problem that I have noticed is that despite the chunk_size being 1024, this code seems to wait until until the code is done and then puts the entire file size in the queue, defeating the point of providing the user with continuous progress on feedback."},"comment":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/comments/228865783","html_url":"https://github.com/kennethreitz/requests/issues/3364#issuecomment-228865783","issue_url":"https://api.github.com/repos/kennethreitz/requests/issues/3364","id":228865783,"user":{"login":"coyotlinden","id":541830,"avatar_url":"https://avatars.githubusercontent.com/u/541830?v=3","gravatar_id":"","url":"https://api.github.com/users/coyotlinden","html_url":"https://github.com/coyotlinden","followers_url":"https://api.github.com/users/coyotlinden/followers","following_url":"https://api.github.com/users/coyotlinden/following{/other_user}","gists_url":"https://api.github.com/users/coyotlinden/gists{/gist_id}","starred_url":"https://api.github.com/users/coyotlinden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coyotlinden/subscriptions","organizations_url":"https://api.github.com/users/coyotlinden/orgs","repos_url":"https://api.github.com/users/coyotlinden/repos","events_url":"https://api.github.com/users/coyotlinden/events{/privacy}","received_events_url":"https://api.github.com/users/coyotlinden/received_events","type":"User","site_admin":false},"created_at":"2016-06-27T20:30:24Z","updated_at":"2016-06-27T20:30:24Z","body":"This is very strange.  Just changing the chunk size variable from a local constant to the passed in value breaks it:\r\n\r\n```\r\n#CHUNK_SIZE = 1024\r\n        req = requests.get('http://download.cloud.secondlife.com/Viewer_4/Second_Life_4_0_5_315117_i386.dmg', stream=True)\r\n        with open('out.bin', 'wb') as fd:\r\n            for chunk in req.iter_content(self.chunk_size):\r\n                fd.write(chunk)\r\n                print \"chunk_size: %s chunk length: %s\" % (self.chunk_size, len(chunk))\r\n```\r\n\r\nGets `chunk_size: 1024 chunk length: 90728799`"}}
{"actor":{"display_login":"coyotlinden"}}