Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2023-06-13 08:07:05 +02:00
parent bf5cee9676
commit a39c439496
4 changed files with 14 additions and 5 deletions

View File

@@ -351,10 +351,13 @@ def uploadactivity(access_token, filename, description='',
name='Rowsandall.com workout'):
data_gz = BytesIO()
with open(filename, 'rb') as inF:
s = inF.read()
with gzip.GzipFile(fileobj=data_gz, mode="w") as gzf:
gzf.write(s)
try:
with open(filename, 'rb') as inF:
s = inF.read()
with gzip.GzipFile(fileobj=data_gz, mode="w") as gzf:
gzf.write(s)
except FileNotFoundError:
return 0
headers = {
'Content-Type': 'application/json',