Question about activity upload #341
Replies: 4 comments 1 reply
-
I tested the upload when working on the integration tests. There were no issues using the |
Beta Was this translation helpful? Give feedback.
-
Ok so now i wonder if i'm doing something wrong. Here is my code from stravalib.client import Client
# Authenticate
client = Client()
client = authenticate(sec_path, client)
# this works just fine (with a few attribute warnings for clubs - i know that
# will change):)
client.get_athlete()
# Upload activity - i could implement a context manager here but i get the same responses
# i would of course change the data type to gpx for a gpx file.
obj = client.upload_activity("stravalib/tests/resources/sample.tcx", data_type = "tcx")
obj.wait() Error with gpx / fit is as follows -It returns a file corrupted error BUT i've downloaded the file from a strava activity on the strava website. I did read the linked resource but it suggests that garmin files sometimes have corruption issues. i do have a garmin watch but shouldn't a gpx file FROM strava be ok?: obj.wait()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1786, in wait
self.poll()
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1760, in poll
self.update_from_response(response)
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1729, in update_from_response
self.raise_for_error()
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1746, in raise_for_error
raise exc.ActivityUploadFailed(self.error)
stravalib.exc.ActivityUploadFailed: Improperly formatted data. <a href="https://support.strava.com/hc/articles/216917967-Uploading-poorly-formatted-GPS-files" target="_blank">More Information</a>. tcx file in the test resources - this makes me think my workflow has errorsWhen i try to tcx file i get a different type of error obj.wait()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1786, in wait
self.poll()
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1760, in poll
self.update_from_response(response)
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1729, in update_from_response
self.raise_for_error()
File "/Users/leahawasser/Documents/GitHub/stravalib/stravalib/client.py", line 1746, in raise_for_error
raise exc.ActivityUploadFailed(self.error)
stravalib.exc.ActivityUploadFailed: Unrecognized file type? file.tcx Am i implementing this incorrectly? Because if it worked well for you and Mohammed, it seems I must be missing something. Many thanks. |
Beta Was this translation helpful? Give feedback.
-
In your examples, you pass a file path (as with open(file_path, 'r') as fp:
uploader = client.upload_activity(fp, [OTHER_ARGS/KWARGS])]
uploaded_activity = uploader.wait() |
Beta Was this translation helpful? Give feedback.
-
I am getting a similar issue. When I upload a garmin tcx file I get the error: my code snippet is: Any help appreciated! |
Beta Was this translation helpful? Give feedback.
-
Hi @stravalib/stravalib-maintainers ! i see another pr which is awesome! i was actually never able to get an activity to upload to strava but i just assumed it was something on my end. did either of you test that? and if so - i wondered if it worked.
I tried to
each time i got an activity format incorrect error when uploading. i can provide the exact code and error.
So i just wanted to ask as we start to review the new pr which adds photo upload (i havent tested it yet).
I have a second question but will ask in another thread about workflow.
Beta Was this translation helpful? Give feedback.
All reactions