diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-11-08 10:02:24 +0900 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-11-08 10:02:24 +0900 |
commit | 8f1a2d564a25dc3bd7f457bd94edda72a64444dd (patch) | |
tree | 7e218b2021772236925e54fb7e271c02610ba89c | |
parent | e0e90a819bcd7bb13f377732ca871068cbf5cd25 (diff) | |
download | cryptography-8f1a2d564a25dc3bd7f457bd94edda72a64444dd.tar.gz cryptography-8f1a2d564a25dc3bd7f457bd94edda72a64444dd.tar.bz2 cryptography-8f1a2d564a25dc3bd7f457bd94edda72a64444dd.zip |
switch to using BytesIO
-rw-r--r-- | tasks.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function import getpass +import io import os import time @@ -77,11 +78,11 @@ def download_artifacts(session): expected_size=int(response.headers["content-length"]), filled_char="=" ) - content = b'' + content = io.BytesIO() for data in response.iter_content(chunk_size=8192): - content += data - bar.show(len(content)) - if bar.expected_size == len(content): + content.write(data) + bar.show(content.tell()) + if bar.expected_size == content.tell(): bar.done() out_path = os.path.join( os.path.dirname(__file__), @@ -89,7 +90,7 @@ def download_artifacts(session): artifact["fileName"], ) with open(out_path, "wb") as f: - f.write(content) + f.write(content.getvalue()) paths.append(out_path) return paths |