Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Upload does not support structured workout .fit-files - add that fact to docs #27

@Jawz84

Description

@Jawz84

Thank you for writing and maintaining Garth!

I just wanted to let you know that - unsurprisingly - Garmin does not allow uploading structured workout files to the upload service. It seems to be only intended for Activities.

repro

I created a custom structured workout FIT file, exactly like the cookbook example from the FIT sdk, so a workout for a 10h endurance ride in zone 2, saved as test.FIT.
When I use

with open("test.FIT", "rb") as f:
    uploaded = garth.client.upload(f)

It confronts me with this error message:

Traceback (most recent call last):
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 127, in request
    self.last_resp.raise_for_status()
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 406 Client Error: Not Acceptable for url: https://connectapi.garmin.com/upload-service/upload

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\joskw\GitNoOneDrive\FIT-Garth\try-garth.py", line 33, in <module>
    uploaded = garth.client.upload(f)
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 173, in upload
    resp = self.post(
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 139, in post
    return self.request("POST", *args, **kwargs)
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 129, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 406 Client Error: Not Acceptable for url: https://connectapi.garmin.com/upload-service/upload

I know there is no way for you to fix this. I just wanted to suggest that it would be helpful for others to mention this limitation in the documentation here: https://github.com/matin/garth#upload

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions