uberfastman / yfpy

Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
https://pypi.org/project/yfpy/
GNU General Public License v3.0
178 stars 46 forks source link

Clean up returned data structures #32

Closed uberfastman closed 1 year ago

uberfastman commented 2 years ago

Currently, when returning lists of objects, YFPY returns them as lists of dictionaries, each with a single key corresponding to the data type of the object value (so a list of Game instances is returned as a list of dictionaries, each with the single key "game", and a single value corresponding to that key that is the YFPY Game object).

The reason for the above is so that unpack_data can properly parse and cast/deserialize the JSON both returned from the Yahoo API and from saved JSON data files.

For an improved user experience and a clearer data structure hierarchy, it would be nice to instead simply return a list of YFPY Game objects. However, in order to do so a new approach to detecting the correct data type will need to be built.