Skip to content

Conversation

@aborem
Copy link
Collaborator

@aborem aborem commented Aug 21, 2025

Closes #48

fetch_vertical

  • Takes in a vertical, request_params for to be sent in the actual HTTP request, and params, which are optional key-word arguments specific to each method.
  • Works by using the vertical's plural name to generate the method name and calling that with the latter two arguments described above. May seem a little risky to call a method based on a name, but given that we check if the vertical is supported and generate the method names based on the vertical names, I think it should be okay (and I wrote tests). As always, open to feedback!
  • For the sake of consistency, I added a request_params argument to every fetch_ method (which I think is smart anyway since our pardners may want fine-grained configurability and may have familiarity with the APIs).

Exception reorganization

  • Moved all exception definitions from services/base.py to exceptions.py
  • Made the list arguments in the exceptions constructors optionally lists to get around having to generate one element lists to raise the exception.

Misc

  • Made helper method (is_vertical_supported(...)) for checking if a vertical is supported using _supported_verticals since it's not unexpected that our pardners may want to check before adding a vertical
  • Renamed fetch_athlete_activities(...) to fetch_physical_activities(...) for consistency
  • Moved request_params to be first argument in all the fetch_ methods.

@aborem aborem requested a review from lisad August 21, 2025 20:16
@aborem aborem changed the title Adds generic fetch_vertical method and organizes code structure Adds generic fetch_vertical method and re-organizes code structure Aug 21, 2025
@aborem aborem merged commit 9848420 into main Aug 22, 2025
1 check passed
@aborem aborem deleted the aborem/fetch-data-method-with-vertical-arg branch August 22, 2025 15:17
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.

Top level method for fetching vertical with vertical as an argument

3 participants