diff --git a/garminexport/garminclient.py b/garminexport/garminclient.py index 268046b..ee74349 100755 --- a/garminexport/garminclient.py +++ b/garminexport/garminclient.py @@ -8,13 +8,14 @@ import logging import os import re import requests -from StringIO import StringIO +from io import BytesIO import sys import zipfile import dateutil import dateutil.parser import os.path from functools import wraps +from builtins import range # # Note: For more detailed information about the API services @@ -163,7 +164,7 @@ class GarminClient(object): batch_size = 100 # fetch in batches since the API doesn't allow more than a certain # number of activities to be retrieved on every invocation - for start_index in xrange(0, sys.maxint, batch_size): + for start_index in range(0, sys.maxsize, batch_size): next_batch = self._fetch_activity_ids_and_ts(start_index, batch_size) if not next_batch: break @@ -332,7 +333,7 @@ class GarminClient(object): # return the first entry from the zip archive where the filename is # activity_id (should be the only entry!) - zip = zipfile.ZipFile(StringIO(response.content), mode="r") + zip = zipfile.ZipFile(BytesIO(response.content), mode="r") for path in zip.namelist(): fn, ext = os.path.splitext(path) if fn==str(activity_id): diff --git a/requirements.txt b/requirements.txt index 2a57eaf..b550dab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ requests==2.9.1 python-dateutil==2.4.1 +future==0.16.0 nose==1.3.7 coverage==4.2 diff --git a/tests/test_retryer.py b/tests/test_retryer.py index b3720fd..e2a6d74 100644 --- a/tests/test_retryer.py +++ b/tests/test_retryer.py @@ -74,7 +74,7 @@ class TestRetryer(unittest.TestCase): func = lambda : int(time.time()) returnval = retryer.call(func) - print returnval + print(returnval) class TestFixedDelayStrategy(unittest.TestCase):