Private
Public Access
1
0

strava bug fixed

This commit is contained in:
Sander Roosendaal
2020-05-15 14:24:44 +02:00
parent b403ace434
commit a034c0b3d1
3 changed files with 19 additions and 2 deletions

View File

@@ -474,6 +474,9 @@ def get_strava_stream(r,metric,stravaid,series_type='time',fetchresolution='high
'Content-Type': 'application/json',
'resolution': 'medium',}
if metric == 'power':
metric = 'watts'
url = "https://www.strava.com/api/v3/activities/{stravaid}/streams/{metric}?resolution={fetchresolution}&series_type={series_type}".format(
stravaid=stravaid,
fetchresolution=fetchresolution,
@@ -484,6 +487,12 @@ def get_strava_stream(r,metric,stravaid,series_type='time',fetchresolution='high
s = requests.get(url,headers=headers)
if metric=='power':
with open('data.txt', 'w') as outfile:
json.dump(s.json(), outfile)
print('saved to file')
for data in s.json():
y = None
try: