-
Notifications
You must be signed in to change notification settings - Fork 678
fix: resolve get_normalized_dict() returning empty for V3 endpoints #606
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
base: master
Are you sure you want to change the base?
fix: resolve get_normalized_dict() returning empty for V3 endpoints #606
Conversation
Add support for V3 endpoints with custom parsers in get_normalized_dict() and get_normalized_json() methods. Previously, these methods only handled legacy format (resultSets/resultSet) and returned empty dictionaries for V3 endpoints like BoxScoreTraditionalV3. Changes: - Store endpoint name in NBAStatsResponse when get_data_sets() is called - Update get_normalized_dict() to use parser for V3 endpoints - Convert parsed V3 data to normalized format (list of dicts) - Add comprehensive unit tests for normalized methods Fixes swar#602
Remove all inline comments and docstrings from the V3 endpoint normalization implementation and associated unit tests to improve code readability and reduce clutter.
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self._endpoint = None | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the intention behind self._endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._endpoint stores the endpoint name from get_data_sets(endpoint="...") so that get_normalized_dict() knows which V3 parser to use.
Without it, get_normalized_dict() only has access to the raw response data (via self.get_dict()), which doesn't contain the endpoint name needed to select the correct parser.
Set to None by default, so legacy endpoints continue working unchanged.
|
Overall this code seems fine. We'll just want test it out and ensure it's working. I do have a comment in the code as I'm trying to understand the need for adding |
|
Tests are included in the PR. Happy to add more if you have specific scenarios in mind! |
Summary
Fixes #602
This PR resolves the issue where
get_normailized*methods return empty values.Notebook Demonstrating Fix
Root Cause:
Solution
Added V3 endpoint support to the normalization pipeline in src/nba_api/stats/library/http.py:
context for normalization
keys)
endpoint is stored
Testing
Created new unit tests and all existing tests pass.