Skip to content

Test Data Retrieval #436

Answered by cwendt94
dtcarls asked this question in Q&A
Jan 26, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Thats a great question, if you are already part of a league or the league is public you can run the espn_api package in debug mode to get all of the request and response from the api calls and then use the data for unit tests. Here is quick example in the CLI

>>> import sys
>>> f = open("log.out", 'w')
>>> sys.stdout = f
>>> from espn_api.football import League
>>> league = League(league_id=1234, year=2022, debug=True)

Then log.out will look something like this

ESPN API Request: url: https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022/segments/0/leagues/1433272309 params: {'view': ['mTeam', 'mRoster', 'mMatchup', 'mSettings', 'mStandings']} headers: None 
ESPN API Response: {'draftDet…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by dtcarls
Comment options

You must be logged in to vote
1 reply
@cwendt94
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants