stravalib
stravalib copied to clipboard
Hazardous segments leaderboard not returned
Authenticated athlete has accepted hazardous segment waiver.
starred = client.get_starred_segments()
for segment in starred:
print ("ID {id} : Name {name}".format(id=segment.id, name=segment.name))
id = segment.id
leaders = client.get_segment_leaderboard(id, following=True)
for rank in leaders:
print (rank)
Returns
ID 865212 : Name The Heart Starter
Traceback (most recent call last):
File "<ipython-input-71-aade82163e82>", line 1, in <module>
runfile('/home/rr/strava2.py', wdir='/home/rr')
File "/home/rr/anaconda3/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 704, in runfile
execfile(filename, namespace)
File "/home/rr/anaconda3/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/home/rr/strava2.py", line 62, in <module>
leaders = client.get_segment_leaderboard(id, following=True)
File "/home/rr/anaconda3/lib/python3.6/site-packages/stravalib-0.10.2-py3.6.egg/stravalib/client.py", line 1058, in get_segment_leaderboard
**params),
File "/home/rr/anaconda3/lib/python3.6/site-packages/stravalib-0.10.2-py3.6.egg/stravalib/protocol.py", line 299, in get
return self._request(url, params=params, check_for_errors=check_for_errors, use_webhook_server=use_webhook_server)
File "/home/rr/anaconda3/lib/python3.6/site-packages/stravalib-0.10.2-py3.6.egg/stravalib/protocol.py", line 221, in _request
self._handle_protocol_error(raw)
File "/home/rr/anaconda3/lib/python3.6/site-packages/stravalib-0.10.2-py3.6.egg/stravalib/protocol.py", line 268, in _handle_protocol_error
raise exc_class(msg, response=response)
ObjectNotFound: Not Found: Record Not Found: []
I can confirm this issue. I have about 120 segments. 5 of them are throwing this error. Would be nice to know what causes this behaviour.
hey @robross74 👋 i'm going through and cleaning up old issues. i see this one is a few years old and also used python 3.6 which we no longer support. i wondered if you are still experiencing this issue and if not - if we could close it. we have totally redone the stravalib API so many of the older quirks associated with the API are fixed now.
all the best!
Ok i did some digging into this. i may need feedback from @jsamoocha
id = 2349299
# i don't see leaderboard here in the return
# https://developers.strava.com/docs/reference/#api-SegmentEfforts-getSegmentEffortById
seg = client.get_segment(id)
i can explore a segment and get information related to my own progress on the segment but i don't see a way to access the leaderboard. I dont see that attribute anywhere in our code base nor do i see it in the strava APi docs.
i also found a community discussion that suggests that leaderboard information is no longer accessible via the api
But then i found this in our test suite - functional tests which we don't run in CI / locally AFAIK
we may be able to close because strava no long supports the leaderboard endpoint, but i just want confirmation before doing so.
then we may need to revisit our functional test suite. (in a separate issue because it is dated / not actually being used i think at this point!)
I think a lot of the API features I was using were locked down, so the application stopped being developed.
I think you can safely close.
Rob Rob Ross Junior Sheepdip Attendant (Acting) Philosophy Department University Wallumaloo Australia
On 21 Jan 2024, at 04:48, Leah Wasser @.***> wrote:
Ok i did some digging into this. i may need feedback from @jsamoochahttps://github.com/jsamoocha
id = 2349299
i don't see leaderboard here in the return
https://developers.strava.com/docs/reference/#api-SegmentEfforts-getSegmentEffortById
seg = client.get_segment(id)
i can explore a segment and get information related to my own progress on the segment but i don't see a way to access the leaderboard. I dont see that attribute anywhere in our code base nor do i see it in the strava APi docs.
i also found a community discussionhttps://communityhub.strava.com/t5/developer-discussions/api-segment-leaderboards-and-efforts/m-p/10038 that suggests that leaderboard information is no longer accessible via the api
But then i found this in our test suite - functional tests which we don't run in CI / locally AFAIKhttps://github.com/stravalib/stravalib/blob/main/src/stravalib/tests/functional/test_client.py#L250
we may be able to close because strava no long supports the leaderboard endpoint, but i just want confirmation before doing so.
then we may need to revisit our functional test suite. (in a separate issue because it is dated / not actually being used i think at this point!)
— Reply to this email directly, view it on GitHubhttps://github.com/stravalib/stravalib/issues/180#issuecomment-1902261838, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALHNI5KWVJRQVHNPSRWZRNDYPQUTHAVCNFSM4GS775J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGIZDMMJYGM4A. You are receiving this because you were mentioned.Message ID: @.***>
We removed everything leaderboard-related in v1.3 as Strava does not support it.
Regarding the functional test suite, we can remove it too. It is not used in CI due to dependencies on a test Strava account, and AFAIK never updated to all the changes since v1.0.
ok sounds good. i'll create an issue to remove those old functional tests. they definitely have never been updated and do rely on the user to setup a app / authentication locally. closing this issue!