dtsong / sleeper-api-wrapper

A Python API wrapper for Sleeper's API: https://docs.sleeper.app/
MIT License
61 stars 21 forks source link

Update stats file #20

Closed wfordh closed 8 months ago

wfordh commented 10 months ago

Wanted to get this up here even though it's not 100% ready yet. Addresses issue #18. Using my add_type_hints branch from PR #19 instead of main since it works off of that.

I added a logger warning since the Stats API is not technically documented / supported on Sleeper anymore. I also reworked a bunch of the methods and added some attributes to the class so that the stats that are pulled are stored directly in it and not an external object like before. That seems like better OOP to me, but I might be wrong. Added KeyError to the try / except clauses to not make them overly broad.

Some open questions I still have include

wfordh commented 10 months ago

I opted for changing as little as possible for now to not introduce any sort of breaking changes for users before the season. Streamlined some by replacing try / except clauses with the Python dictionary's built-in get() method. Otherwise just adding the warning and docstrings for each method.

wfordh commented 8 months ago

Gonna go ahead and merge - looks like I can do that without an approval since the base branch isn't master / main. Will make a PR then for merging into main and will need an approval there