Skip to content

Commit 5bf65f6

Browse files
authored
Merge pull request #128 from bitbar/devel
Fixed chunked downloads
2 parents fb68d11 + 5a511c0 commit 5bf65f6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2.69.3
2+
* Fixed chunked downloads
13
2.69.2
24
* Added method to list devices from device groups
35
2.69.1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys, os
44

55

6-
version = '2.69.2'
6+
version = '2.69.3'
77

88
setup(name='testdroid',
99
version=version,

testdroid/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from optparse import OptionParser
1212
from datetime import datetime
1313

14-
__version__ = '2.69.2'
14+
__version__ = '2.69.3'
1515

1616
FORMAT = "%(message)s"
1717
logging.basicConfig(format=FORMAT)
@@ -199,10 +199,14 @@ def download(self, path=None, filename=None, payload={}, callback=None):
199199
res = requests.get(url, params=payload, headers=self._build_headers(), stream=True, timeout=(60.0))
200200

201201
if res.status_code in range(200, 300):
202-
logger.info("Downloading %s (%s bytes)" % (filename, res.headers["Content-Length"]))
203-
pos = 0
204-
total = res.headers['content-length']
202+
try:
203+
total = res.headers['Content-length']
204+
logger.info("Downloading %s (%s bytes)" % (filename, total))
205+
except KeyError as e:
206+
callback = None
205207

208+
pos = 0
209+
206210
# Check if the system is Windows or not.
207211
if os.name == 'nt':
208212
fd = os.open(filename, os.O_RDWR|os.O_CREAT|os.O_BINARY)

0 commit comments

Comments
 (0)