removing some duplicate code
This commit is contained in:
@@ -67,6 +67,8 @@ import requests
|
||||
import longtask
|
||||
import arrow
|
||||
|
||||
from utils import get_strava_stream
|
||||
|
||||
siteurl = SITE_URL
|
||||
|
||||
# testing task
|
||||
@@ -98,20 +100,13 @@ def handle_strava_import_stroke_data(stravatoken,
|
||||
workoutsummary['timezone'] = "Etc/UTC"
|
||||
startdatetime = workoutsummary['start_date']
|
||||
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/cadence?resolution="+fetchresolution+"&series_type="+series_type
|
||||
spmjson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/heartrate?resolution="+fetchresolution+"&series_type="+series_type
|
||||
hrjson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/time?resolution="+fetchresolution+"&series_type="+series_type
|
||||
timejson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/velocity_smooth?resolution="+fetchresolution+"&series_type="+series_type
|
||||
velojson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/distance?resolution="+fetchresolution+"&series_type="+series_type
|
||||
distancejson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/latlng?resolution="+fetchresolution+"&series_type="+series_type
|
||||
latlongjson = requests.get(url,headers=headers)
|
||||
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/watts?resolution="+fetchresolution+"&series_type="+series_type
|
||||
wattsjson = requests.get(url,headers=headers)
|
||||
spmjson = get_strava_stream(r,'cadence',stravaid)
|
||||
hrjson = get_strava_stream(r,'heartrate',stravaid)
|
||||
timejson = get_strava_stream(r,'time',stravaid)
|
||||
velojson = get_strava_stream(r,'velocity_smooth',stravaid)
|
||||
distancejson = get_strava_stream(r,'distance',stravaid)
|
||||
latlongjson = get_strava_stream(r,'latlng',stravaid)
|
||||
wattsjson = get_strava_stream(r,'watts',stravaid)
|
||||
|
||||
try:
|
||||
t = np.array(timejson.json()[0]['data'])
|
||||
|
||||
Reference in New Issue
Block a user