Skip to content

Commit

Permalink
Fix setio download status code handling, imports, images, misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cpfair committed Aug 11, 2017
1 parent d2ed99b commit 9ce7f24
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tapiriik/services/Setio/setio.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def DownloadActivityList(self, svcRecord, exhaustive=False):
user_exception=UserException(UserExceptionType.Authorization,
intervention_required=True))

activity.Notes = None
if streamdata.status_code == 200: # Ok
try:
commentdata = streamdata.json()
Expand All @@ -164,10 +165,6 @@ def DownloadActivityList(self, svcRecord, exhaustive=False):

if "comment" in commentdata:
activity.Notes = commentdata["comment"]
else:
activity.Notes = None
else:
activity.Notes = None

activity.GPS = True

Expand All @@ -180,7 +177,6 @@ def DownloadActivityList(self, svcRecord, exhaustive=False):
return activities, exclusions

def DownloadActivity(self, svcRecord, activity):

activityID = activity.ServiceData["ActivityID"]
extID = svcRecord.ExternalID
url = self.SetioDomain + "getRunData"
Expand All @@ -198,11 +194,13 @@ def DownloadActivity(self, svcRecord, activity):
user_exception=UserException(UserExceptionType.Authorization,
intervention_required=True))

if streamdata.status_code == 200: # Ok
try:
streamdata = streamdata.json()
except:
raise APIException("Stream data returned is not JSON")
if streamdata.status_code != 200:
raise APIException("Unknown Setio response %d %s" % (streamdata.status_code, streamdata.text))

try:
streamdata = streamdata.json()
except:
raise APIException("Stream data returned is not JSON")

ridedata = {}

Expand Down
2 changes: 2 additions & 0 deletions tapiriik/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
BeginnerTriathlete = BeginnerTriathleteService()
from tapiriik.services.Pulsstory import PulsstoryService
Pulsstory = PulsstoryService()
from tapiriik.services.Setio import SetioService
Setio = SetioService()

PRIVATE_SERVICES = []
try:
Expand Down
File renamed without changes

0 comments on commit 9ce7f24

Please sign in to comment.