Closed davinkevin closed 6 years ago
I had some success manually deleting the DataSource (works on next run after this):
curl --header "Authorization: Bearer ya29.SECRETHERE" -X DELETE \
--header "Content-Type: application/json;encoding=utf-8" \
"https://www.googleapis.com/fitness/v1/users/me/dataSources/raw:com.google.body.fat.percentage:fitbit:aria:io.pkp.fbit-gfit"
But then I'm running into errors about:
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources/raw%3Acom.google.weight%3AXXXXXXXX%3Afitbit%3Aaria%3Aio.pkp.fbit-gfit/datasets/1519720264000000000-1519720264000000110?alt=json returned "Unable to fetch DataSource for Dataset: raw:com.google.weight:312047935529:fitbit:aria:io.pkp.fbit-gfit">
Though if I manually issue the curl request, it completes successfully. So either Google's API is having issues or the python wrapper is buggy it would seem? I'm not sure.
Alright, after a bunch more debugging... open up convertors.py
and comment out line 355:
- projectNumber,
+ #projectNumber,
Looking at Google Fit on my phone after, I can see that weight definitely has synced (that's the only one I tried).
No idea why this works... their API docs seem to say this should not work, but it obviously does.
@ericzinnikas Thanks for digging in. Sorry, I didn't get a chance to look into this lately. I will find a proper fix when I revisit the project.
Thx for the help, I will try that as soon as possible !
This totally solves the problem without even delete the previous element
my line 355 in converters.py are:
dataSource['device']['manufacturer'],
But I am getting the same error, any good suggestions?
See my comment above, it is line 354 now (the "projectNumber," line).
I've got the same error.
Traceback (most recent call last):
File "/Users/theovandersluijs/PycharmProjects/fitbit-googlefit/remote.py", line 122, in CreateGoogleFitDataSource
dataSourceId=self.convertor.GetDataSourceId(dataType)).execute()
File "/Users/theovandersluijs/PycharmProjects/fitbitenv/lib/python3.6/site-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Users/theovandersluijs/PycharmProjects/fitbitenv/lib/python3.6/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources/raw%3Acom.google.step_count.delta%3A984249661236%3Afitbit%3Acharge-hr%3Aio.pkp.fbit-gfit?alt=json returned "DataSourceId not found: raw:com.google.step_count.delta:984249661236:fitbit:charge-hr:io.pkp.fbit-gfit">
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 110, in <module>
main()
File "app.py", line 60, in main
remote.CreateGoogleFitDataSource(dataType)
File "/Users/theovandersluijs/PycharmProjects/fitbit-googlefit/remote.py", line 129, in CreateGoogleFitDataSource
body=self.convertor.GetDataSource(dataType)).execute()
File "/Users/theovandersluijs/PycharmProjects/fitbitenv/lib/python3.6/site-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Users/theovandersluijs/PycharmProjects/fitbitenv/lib/python3.6/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 409 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources?alt=json returned "Data Source: raw:com.google.step_count.delta:fitbit:charge-hr:io.pkp.fbit-gfit already exists">
Resolved in #58
Hi,
I followed the auth process very carefully and all went well, but when I launch for the first time the
app.py
, I've got the following result:I don't know what to do to help solve this problem
Thanks