Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

description field not correctly read from strava #142

Closed
maartenmennes opened this issue Feb 19, 2018 · 3 comments
Closed

description field not correctly read from strava #142

maartenmennes opened this issue Feb 19, 2018 · 3 comments
Labels

Comments

@maartenmennes
Copy link

Hello,
I'm trying to access the description field of a ride to fetch the comments I made on a ride. However, it looks like that field is always 'None'?

@maartenmennes
Copy link
Author

hello, I was wondering if there was any update regarding this question? Perhaps I'm doing something wrong? Thanks for the great work!

@lwasser
Copy link
Collaborator

lwasser commented Jan 17, 2024

hey @maartenmennes i'm going through and looking at old issues. we have redone the entire stravalib API since this issue was posted. i have not yet tested to see if i can access the activity description lately but i'm just wondering if you are still encountering this issue.

i see this closed issue that you also commented on. please let us know if this is a persistent problem with the new stravalib api or if this could be closed.

@lwasser lwasser added the bug label Jan 17, 2024
@lwasser
Copy link
Collaborator

lwasser commented Jan 20, 2024

Ok i have tested this out. This actually relates to this issue . Essentially the data are there in the stravalib return. however you have to use get_activity() rather than get_activities() to capture description information. This is because of some support for legacy stravalib behavior which we are discussing in the newer issue.

But because we are talking this through in the other issue and this issue is quite old - i'm going to close it. @maartenmennes feel free to reach out to us / open a new issue if something comes up that we can help you with. at a minimum we will document this somewhere to make it easier for users to understand why they are getting empty returns with some calls! the data are there just not where it seems like they should be!

A fix for returning the description is below.

activities = client.get_activities(after="2024-01-18")
for activity in activities:
    # This returns None / empty as it's **not** a summary level attribute but the key does appear in the returned object
    activity.description
    # this will return calories and description as it's a detailed level attr that can be accessed via get_activity
    detailed = client.get_activity(activity.id)
    detailed.calories
    detailed.description

@lwasser lwasser closed this as completed Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants