Merge branch 'python_2_3' of https://github.com/cwygoda/garminexport into cwygoda-python_2_3

This commit is contained in:
petergardfjall 2018-09-01 08:39:56 +02:00
commit d79232af41
3 changed files with 6 additions and 4 deletions

View File

@ -8,13 +8,14 @@ import logging
import os import os
import re import re
import requests import requests
from StringIO import StringIO from io import BytesIO
import sys import sys
import zipfile import zipfile
import dateutil import dateutil
import dateutil.parser import dateutil.parser
import os.path import os.path
from functools import wraps from functools import wraps
from builtins import range
# #
# Note: For more detailed information about the API services # Note: For more detailed information about the API services
@ -163,7 +164,7 @@ class GarminClient(object):
batch_size = 100 batch_size = 100
# fetch in batches since the API doesn't allow more than a certain # fetch in batches since the API doesn't allow more than a certain
# number of activities to be retrieved on every invocation # 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) next_batch = self._fetch_activity_ids_and_ts(start_index, batch_size)
if not next_batch: if not next_batch:
break break
@ -332,7 +333,7 @@ class GarminClient(object):
# return the first entry from the zip archive where the filename is # return the first entry from the zip archive where the filename is
# activity_id (should be the only entry!) # 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(): for path in zip.namelist():
fn, ext = os.path.splitext(path) fn, ext = os.path.splitext(path)
if fn==str(activity_id): if fn==str(activity_id):

View File

@ -1,5 +1,6 @@
requests==2.9.1 requests==2.9.1
python-dateutil==2.4.1 python-dateutil==2.4.1
future==0.16.0
nose==1.3.7 nose==1.3.7
coverage==4.2 coverage==4.2

View File

@ -74,7 +74,7 @@ class TestRetryer(unittest.TestCase):
func = lambda : int(time.time()) func = lambda : int(time.time())
returnval = retryer.call(func) returnval = retryer.call(func)
print returnval print(returnval)
class TestFixedDelayStrategy(unittest.TestCase): class TestFixedDelayStrategy(unittest.TestCase):