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

Update ESPN API Base Endpoint #540

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions espn_api/requests/constant.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FANTASY_BASE_ENDPOINT = 'https://fantasy.espn.com/apis/v3/games/'

FANTASY_BASE_ENDPOINT = 'https://lm-api-reads.fantasy.espn.com/apis/v3/games/'
FANTASY_SPORTS = {
'nfl' : 'ffl',
'nba' : 'fba',
Expand Down
7 changes: 4 additions & 3 deletions tests/football/unit/test_league.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import mock, TestCase
from espn_api.football import League, BoxPlayer
from espn_api.requests.constant import FANTASY_BASE_ENDPOINT
from espn_api.football.helper import (
build_division_record_dict,
build_h2h_dict,
Expand All @@ -19,8 +20,8 @@ class LeagueTest(TestCase):
def setUp(self):
self.league_id = 123
self.season = 2018
self.espn_endpoint = "https://fantasy.espn.com/apis/v3/games/FFL/seasons/" + str(self.season) + "/segments/0/leagues/" + str(self.league_id)
self.players_endpoint = 'https://fantasy.espn.com/apis/v3/games/ffl/seasons/' + str(self.season) + '/players?view=players_wl'
self.espn_endpoint = FANTASY_BASE_ENDPOINT + 'FFL/seasons/' + str(self.season) + '/segments/0/leagues/' + str(self.league_id)
self.players_endpoint = FANTASY_BASE_ENDPOINT + 'ffl/seasons/' + str(self.season) + '/players?view=players_wl'
with open('tests/football/unit/data/league_2018_data.json') as data:
self.league_data = json.loads(data.read())
with open('tests/football/unit/data/league_draft_2018.json') as data:
Expand Down Expand Up @@ -462,7 +463,7 @@ def test_recent_activity(self, m):

# TODO hack until I get all mock data for 2019
league.year = 2019
self.espn_endpoint = "https://fantasy.espn.com/apis/v3/games/ffl/seasons/" + str(2019) + "/segments/0/leagues/" + str(self.league_id)
self.espn_endpoint = FANTASY_BASE_ENDPOINT + 'ffl/seasons/' + str(2019) + '/segments/0/leagues/' + str(self.league_id)
league.espn_request.LEAGUE_ENDPOINT = self.espn_endpoint

with open('tests/football/unit/data/league_recent_activity_2019.json') as f:
Expand Down
5 changes: 3 additions & 2 deletions tests/football/unit/test_past_league.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import mock, TestCase
from espn_api.football import League
from espn_api.requests.constant import FANTASY_BASE_ENDPOINT
import requests_mock
import json

Expand All @@ -9,8 +10,8 @@ class LeaguePastTest(TestCase):
def setUp(self):
self.league_id = 123
self.season = 2015
self.espn_endpoint = "https://fantasy.espn.com/apis/v3/games/ffl/leagueHistory/" + str(self.league_id) + "?seasonId=2015"
self.players_endpoint = 'https://fantasy.espn.com/apis/v3/games/ffl/seasons/' + str(self.season) + '/players?view=players_wl'
self.espn_endpoint = FANTASY_BASE_ENDPOINT + 'ffl/leagueHistory/' + str(self.league_id) + '?seasonId=2015'
self.players_endpoint = FANTASY_BASE_ENDPOINT + 'ffl/seasons/' + str(self.season) + '/players?view=players_wl'
with open('tests/football/unit/data/league_2015_data.json') as data:
self.league_data = json.loads(data.read())
with open('tests/football/unit/data/league_draft_2015.json') as data:
Expand Down
Loading