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

Better error handling if credentials are incorrect #19

Open
Kjeldgaard opened this issue Oct 12, 2022 · 0 comments
Open

Better error handling if credentials are incorrect #19

Kjeldgaard opened this issue Oct 12, 2022 · 0 comments

Comments

@Kjeldgaard
Copy link
Owner

Currently the output is

2022-10-12 18:42:41 INFO fantasy_stats.py:36: Getting League data: Started
Traceback (most recent call last):
  File "/mnt/c/projects/FantasyStats/main.py", line 154, in <module>
    main(**vars(args))
  File "/mnt/c/projects/FantasyStats/main.py", line 54, in main
    fantasy_stats = FantasyStats(
  File "/mnt/c/projects/FantasyStats/fantasy_stats.py", line 37, in __init__
    self.league = League(league_id=league_id, year=year, espn_s2=espn_s2, swid=swid)
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/football/league.py", line 23, in __init__
    self.fetch_league()
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/football/league.py", line 26, in fetch_league
    self._fetch_league()
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/football/league.py", line 29, in _fetch_league
    data = super()._fetch_league()
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/base_league.py", line 30, in _fetch_league
    data = self.espn_request.get_league()
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/requests/espn_requests.py", line 74, in get_league
    data = self.league_get(params=params)
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/requests/espn_requests.py", line 54, in league_get
    checkRequestStatus(r.status_code, cookies=self.cookies, league_id=self.league_id)
  File "/mnt/c/projects/FantasyStats/.venv/lib/python3.10/site-packages/espn_api/requests/espn_requests.py", line 25, in checkRequestStatus
    raise ESPNAccessDenied(f"League {league_id} cannot be accessed with swid={cookies.get('espn_s2')} and swid={cookies.get('SWID')}")
espn_api.requests.espn_requests.ESPNAccessDenied: League 123456 cannot be accessed with swid=123456
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

1 participant