cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
544 stars 183 forks source link

adding an offset parameter to support paging through all activities #461

Closed spkane31 closed 10 months ago

spkane31 commented 10 months ago

Adds an optional parameter to support offset in the recent_activity method on League.

The benefit of this is the code for retrieving recent activity (1000 events in my example) can be more finely controlled.

league = League(...)
activity = league.recent_activity(1000)

is now

league = League(...)
offset = 0
limit = 25
for True: # Implement a stopping condition
    activity = league.recent_activity(limit=limit, offset=offset)
    offset += limit

Looks like my editor also removed some blank space, I can add that back if it makes the PR tougher to read.

codecov-commenter commented 10 months ago

Codecov Report

Patch coverage: 70.00% and no project coverage change.

Comparison is base (81f8967) 80.36% compared to head (c22e9a2) 80.36%. Report is 4 commits behind head on master.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #461 +/- ## ======================================= Coverage 80.36% 80.36% ======================================= Files 60 60 Lines 2109 2109 ======================================= Hits 1695 1695 Misses 414 414 ``` | [Files Changed](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt) | Coverage Δ | | |---|---|---| | [espn\_api/baseball/league.py](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt#diff-ZXNwbl9hcGkvYmFzZWJhbGwvbGVhZ3VlLnB5) | `65.54% <50.00%> (ø)` | | | [espn\_api/wbasketball/league.py](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt#diff-ZXNwbl9hcGkvd2Jhc2tldGJhbGwvbGVhZ3VlLnB5) | `40.94% <50.00%> (ø)` | | | [espn\_api/basketball/league.py](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt#diff-ZXNwbl9hcGkvYmFza2V0YmFsbC9sZWFndWUucHk=) | `85.44% <66.66%> (ø)` | | | [espn\_api/football/league.py](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt#diff-ZXNwbl9hcGkvZm9vdGJhbGwvbGVhZ3VlLnB5) | `94.52% <100.00%> (ø)` | | | [espn\_api/hockey/league.py](https://app.codecov.io/gh/cwendt94/espn-api/pull/461?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Christian+Wendt#diff-ZXNwbl9hcGkvaG9ja2V5L2xlYWd1ZS5weQ==) | `84.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cwendt94 commented 10 months ago

Nice, this is a great addition to recent activity! Thanks for creating a PR and adding this!