File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -2082,8 +2082,18 @@ def garmin_upload(player_id, activity):
2082
2082
except Exception as exc :
2083
2083
logger .warning ("Failed to read %s. Skipping Garmin upload attempt: %s" % (garmin_credentials , repr (exc )))
2084
2084
return
2085
+ tokens_dir = '%s/garth' % profile_dir
2086
+ try :
2087
+ garth .resume (tokens_dir )
2088
+ garth .client .username
2089
+ except :
2090
+ try :
2091
+ garth .login (username , password )
2092
+ garth .save (tokens_dir )
2093
+ except Exception as exc :
2094
+ logger .warning ("Garmin login failed: %s" % repr (exc ))
2095
+ return
2085
2096
try :
2086
- garth .login (username , password )
2087
2097
requests .post ('https://connect.garmin.com/upload-service/upload/.fit' , files = {'file' : BytesIO (activity .fit )},
2088
2098
headers = {'NK' : 'NT' , 'authorization' : garth .client .oauth2_token .__str__ (), 'di-backend' : 'connectapi.garmin.com' })
2089
2099
except Exception as exc :
You can’t perform that action at this time.
0 commit comments