Skip to content

Conversation

@aborem
Copy link
Collaborator

@aborem aborem commented Aug 15, 2025

Closes #42

Some constraints with the Strava API:

  • When you make the lowest tier Strava application, you're only allowed one authorized user at a time. If you apply for more permissions, you can have additional users.
  • The single authorized user for the lowest tier can be anyone, it doesn't have to be the creator of the application.
  • The interactions with the API (i.e., the types of requests and responses) are identical for any tier, so what I've written in this PR should work for tiers with more permissions too.

I also extract the OAuth2 Session GET request call into the base class for generalizability.

Sample response
[
    {
        "resource_state": 2,
        "athlete": {"id": 111, "resource_state": 1},
        "name": "Afternoon Run",
        "distance": 111,
        "moving_time": 111,
        "elapsed_time": 111,
        "total_elevation_gain": 0.0,
        "type": "Run",
        "sport_type": "Run",
        "workout_type": 0,
        "id": 14676384061,
        "start_date": "2025-06-02T20:47:04Z",
        "start_date_local": "2025-06-02T15:47:04Z",
        "timezone": "(GMT-06:00) America/Chicago",
        "utc_offset": -18000.0,
        "location_city": null,
        "location_state": null,
        "location_country": null,
        "achievement_count": 0,
        "kudos_count": 1,
        "comment_count": 0,
        "athlete_count": 1,
        "photo_count": 0,
        "map": {
            "id": "111",
            "summary_polyline": "111111111111",
            "resource_state": 2,
        },
        "trainer": false,
        "commute": false,
        "manual": false,
        "private": false,
        "visibility": "followers_only",
        "flagged": false,
        "gear_id": null,
        "start_latlng": [111.111, -111.111],
        "end_latlng": [111.111, -111.111],
        "average_speed": 111.111,
        "max_speed": 111.111,
        "has_heartrate": false,
        "heartrate_opt_out": false,
        "display_hide_heartrate_option": false,
        "elev_high": 111.111,
        "elev_low": 111.111,
        "upload_id": 111,
        "upload_id_str": "111",
        "external_id": "111-activity.fit",
        "from_accepted_tag": false,
        "pr_count": 0,
        "total_photo_count": 0,
        "has_kudoed": false,
    }
]

@aborem aborem requested a review from lisad August 15, 2025 16:16

def _get_resource(self, uri: str, params: dict[str, Any] = {}) -> Response:
"""
Sends a GET request to `uri` using `OAuth2Session`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if/when we get to generating documentation, the backtick looks for references - and I don't think params like 'uri' work as references so they cause errors

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thanks! Seems like double backticks is what I'm looking for. #52 for the future

@aborem aborem merged commit 0913a3a into main Aug 15, 2025
1 check passed
@aborem aborem deleted the aborem/strava-get-feed branch August 15, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transfer Strava activity data methods

3 participants