Merge pull request #13 from matlink/master

Fix progression slow down
This commit is contained in:
Domenico Iezzi 2017-10-08 18:21:13 +02:00 committed by GitHub
commit f4799d3567

View File

@ -442,8 +442,12 @@ class GooglePlayAPI(object):
response_content = bytes() response_content = bytes()
response = requests.get(downloadUrl, headers=headers, cookies=cookies, verify=ssl_verify, stream=True) response = requests.get(downloadUrl, headers=headers, cookies=cookies, verify=ssl_verify, stream=True)
total_length = int(response.headers.get('content-length')) total_length = int(response.headers.get('content-length'))
for chunk in progress.bar(response.iter_content(chunk_size=1024), expected_size=(total_length >> 10) + 1): chunk_size = 32 * (1<<10) # 32 KB
bar = progress.Bar(expected_size=(total_length >> 10))
for index, chunk in enumerate(response.iter_content(chunk_size=chunk_size)):
response_content += chunk response_content += chunk
bar.show(index * chunk_size >> 10)
bar.done()
return response_content return response_content
def download(self, packageName, versionCode, def download(self, packageName, versionCode,