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

Years 2018 and 2019 don't work #614

Closed
narry67 opened this issue Nov 23, 2024 · 7 comments
Closed

Years 2018 and 2019 don't work #614

narry67 opened this issue Nov 23, 2024 · 7 comments

Comments

@narry67
Copy link

narry67 commented Nov 23, 2024

Sport

Football

Summary

I am pulling from a private league. Years 2014-2017 and 2020-2024 work fine but when attempting to get 2018/2019 I get the error shown in the logs/data section. Any assistance would be appreciated.

Logs/Data

/Users/username/Documents/PROJECT-NAME/.venv/bin/python /Users/username/Documents/PROJECT-NAME/API-ESPN.py
Traceback (most recent call last):
File "/Users/username/Documents/PROJECT-NAME/API-ESPN.py", line 16, in
league = League(league_id=286725, year=2019, espn_s2=s2_2018, swid=swid, debug=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/football/league.py", line 32, in init
self.fetch_league()
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/football/league.py", line 35, in fetch_league
self._fetch_league()
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/football/league.py", line 38, in _fetch_league
data = super()._fetch_league(SettingsClass=Settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/base_league.py", line 32, in _fetch_league
data = self.espn_request.get_league()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/requests/espn_requests.py", line 75, in get_league
data = self.league_get(params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/requests/espn_requests.py", line 55, in league_get
checkRequestStatus(r.status_code, cookies=self.cookies, league_id=self.league_id)
File "/Users/username/Documents/PROJECT-NAME/.venv/lib/python3.12/site-packages/espn_api/requests/espn_requests.py", line 26, in checkRequestStatus
raise ESPNAccessDenied(f"League {league_id} cannot be accessed with espn_s2={cookies.get('espn_s2')} and swid={cookies.get('SWID')}")
espn_api.requests.espn_requests.ESPNAccessDenied: League 286725 cannot be accessed with espn_s2=YOUR_ESPNS2_PLACEHOLDER and swid={YOUR_SWID_PLACEHOLDER}

Process finished with exit code 1

@Robert-litts
Copy link
Contributor

Robert-litts commented Nov 25, 2024

I have the same issue & submitted issued #278 a while back, I believe it had to do with the change in ESPN's api that year and the way the JSON was being parsed. I attempted to resolve this via PR #514, but it failed automated testing and I never got around to fixing it. I'll try and find some time to circle back and look into this, having some issues getting the code to run locally right now.

@cwendt94
Copy link
Owner

At least for this issue, this is throwing access denied before the data is even parsed. ESPN API is returning a 401 unauthorized status. @narry67 during 2018 and 2019 season were you part of the league? Are you able to see the league during that time on ESPN's website?

@narry67
Copy link
Author

narry67 commented Nov 26, 2024

@cwendt94 Hmm. I was a part of the league those years. I see my league through this link https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/leagueHistory/286725?seasonId=2019

if I use https://fantasy.espn.com/football/league/history?leagueId=286725&seasonId=2016 I can see a list of all my seasons including 18-19 as seen in the screenshot. However if I then go to "league office" or https://fantasy.espn.com/football/league?seasonId=2023&leagueId=286725 then I get a permission denied for those 2 years.

image

@narry67
Copy link
Author

narry67 commented Nov 26, 2024

Apparently my league mates have access to it. I have no idea what I did different those years :(

@cwendt94
Copy link
Owner

That is really weird, so seems like a bug on ESPN's side. I wonder if there are any settings the commissioner can update or check out?

@narry67
Copy link
Author

narry67 commented Nov 27, 2024

I am not sure but I can just use one of their cookies for the moment so the issue shouldn’t affect me anymore. I appreciate you all taking the time to help.

@narry67 narry67 closed this as completed Nov 27, 2024
@cwendt94
Copy link
Owner

No problem, glad you are able to use a work around!

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

No branches or pull requests

3 participants