Skip to content
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

Basketball League Transactions #598

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

simonbilskyrollins
Copy link
Contributor

New method League.transactions() uses the mTransactions2 view to fetch more detailed transaction data than is available through recent_activity.

I'm only fetching free agent and waiver transactions right now because that's the only data I have available to test with in my league, however trades and roster moves are also available. In my testing I got a surprisingly helpful error message that enumerated all available transaction types:

DRAFT, TRADE_ACCEPT, WAIVER, TRADE_VETO, FUTURE_ROSTER, ROSTER, RETRO_ROSTER, TRADE_PROPOSAL, TRADE_UPHOLD, FREEAGENT, TRADE_DECLINE, WAIVER_ERROR, TRADE_ERROR

Copy link

codecov bot commented Oct 26, 2024

Codecov Report

Attention: Patch coverage is 31.42857% with 24 lines in your changes missing coverage. Please review.

Project coverage is 83.18%. Comparing base (be5e92b) to head (492bacc).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
espn_api/basketball/transaction.py 30.00% 14 Missing ⚠️
espn_api/basketball/league.py 28.57% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #598      +/-   ##
==========================================
- Coverage   83.98%   83.18%   -0.80%     
==========================================
  Files          60       61       +1     
  Lines        2254     2290      +36     
==========================================
+ Hits         1893     1905      +12     
- Misses        361      385      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@cwendt94 cwendt94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this feature as well. I just have a couple recommendations. Could you also add the transaction types to the constant map

@@ -0,0 +1,7 @@
class TransactionItem(object):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be better defined in the same file as transactions

espn_api/basketball/league.py Show resolved Hide resolved
'scoringPeriodId': scoring_period,
}

filters = {"transactions":{"filterType":{"value":["FREEAGENT","WAIVER","WAIVER_ERROR"]}}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having these filter types as default is good and then allow it to be passed in to the function as well in case you only want to look for one or different ones.

@simonbilskyrollins
Copy link
Contributor Author

Thanks for the feedback @cwendt94! Updated accordingly.

Copy link
Owner

@cwendt94 cwendt94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding this feature!

@cwendt94 cwendt94 merged commit 365c3ca into cwendt94:master Nov 6, 2024
2 of 3 checks passed
@simonbilskyrollins simonbilskyrollins deleted the transactions branch November 10, 2024 19:21
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.

2 participants