Skip to content

Commit

Permalink
Merge pull request #540 from cwendt94/espn-base-api
Browse files Browse the repository at this point in the history
Update ESPN API Base Endpoint
  • Loading branch information
cwendt94 authored Apr 25, 2024
2 parents b2c37be + 0e39576 commit 42fb1d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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

0 comments on commit 42fb1d0

Please sign in to comment.