motherapp / weight-csv-to-gfit

Load weights.csv and import to a Google Fit account
25 stars 20 forks source link

HttpError 400 and 409 when running import script for weight #8

Closed tobiasehlert closed 2 years ago

tobiasehlert commented 3 years ago

Trying to run the script.. but getting some errors I don't get.

Received following running script for first time:

got weights...
Traceback (most recent call last):
  File "import_weight_to_gfit.py", line 128, in <module>
    import_weight_to_gfit()
  File "import_weight_to_gfit.py", line 118, in import_weight_to_gfit
    point=weights,
  File "/usr/lib/python2.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/googleapiclient/http.py", line 915, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://fitness.googleapis.com/fitness/v1/users/me/dataSources/raw%3Acom.google.weight%3AAAA%3Awithings%3Asmart-body-MASKEDURLBLABLA returned "Unable to fetch DataSource for Dataset: raw:com.google.weight:ABC:DEF:GHI:JKL". Details: "Unable to fetch DataSource for Dataset: raw:com.google.weight:ABC:DEF:GHI:JKL">

Running script for second or more time:

  File "import_weight_to_gfit.py", line 128, in <module>
    import_weight_to_gfit()
  File "import_weight_to_gfit.py", line 101, in import_weight_to_gfit
    body=data_source).execute()
  File "/usr/lib/python2.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/googleapiclient/http.py", line 915, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 409 when requesting https://fitness.googleapis.com/fitness/v1/users/me/dataSources?alt=json&key=XXXXXX  returned "Data Source: raw:com.google.weight:ABC:DEF:GHI:JKL already exists". Details: "Data Source: raw:com.google.weight:ABC:DEF:GHI:JKL already exists">

First time I did run it, everythings seems fine.. but Google Fit does not display any weights in Google Fit app. So not sure weither the data was correct imported.

jpmeijers commented 3 years ago

I'm getting the same errors when running the script