Private
Public Access
1
0

refactoring importviews, part 1

This commit is contained in:
Sander Roosendaal
2023-02-16 08:39:27 +01:00
parent b179f3f9cf
commit f17fb560c5
10 changed files with 113 additions and 263 deletions

View File

@@ -51,6 +51,12 @@ class TPIntegration(SyncIntegration):
'scope': 'write',
}
def get_name(self):
return "TrainingPeaks"
def get_shortname(self):
return "trainingpeaks"
def createworkoutdata(self, w, *args, **kwargs):
filename = w.csvfilename
row = rowingdata(csvfile=filename)
@@ -88,7 +94,16 @@ class TPIntegration(SyncIntegration):
raise NotImplementedError("not implemented")
def make_authorization_url(self, *args, **kwargs) -> str: # pragma: no cover
return super(TPIntegration, self).make_authorization_url(self, *args, **kwargs)
params = {"client_id": TP_CLIENT_KEY,
"response_type": "code",
"redirect_uri": TP_REDIRECT_URI,
"scope": "file:write",
}
url = TP_OAUTH_LOCATION+"oauth/authorize/?" + \
urllib.parse.urlencode(params)
return url
def get_token(self, code, *args, **kwargs) -> (str, int, str):
# client_auth = requests.auth.HTTPBasicAuth(TP_CLIENT_KEY, TP_CLIENT_SECRET)