Skip to content

Commit

Permalink
Merge pull request #249 from mkreiser/lm-api-reads
Browse files Browse the repository at this point in the history
Update baseURL for fantasy.espn based URLs
  • Loading branch information
mkreiser authored Jan 4, 2025
2 parents e73cb6f + 8c08578 commit 2fef56f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3560,6 +3560,7 @@ exports[`2016 season integration tests getNFLGamesForPeriod returns a populated
"team": "Minnesota Vikings",
"teamAbbrev": "MIN",
},
"odds": [],
"quarter": 4,
"startTime": 2016-10-04T00:30:00.000Z,
},
Expand All @@ -3581,6 +3582,7 @@ exports[`2016 season integration tests getNFLGamesForPeriod returns a populated
"team": "San Francisco 49ers",
"teamAbbrev": "SF",
},
"odds": [],
"quarter": 4,
"startTime": 2016-10-07T00:25:00.000Z,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91489,7 +91489,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Indianapolis Colts",
"teamAbbrev": "IND",
},
"broadcaster": "FOX/NFL NET",
"broadcaster": "FOX/NFL Net",
"clock": "0:00",
"gameStatus": "Final",
"homeTeam": {
Expand All @@ -91499,6 +91499,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New England Patriots",
"teamAbbrev": "NE",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-05T00:20:00.000Z,
},
Expand All @@ -91520,6 +91521,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Buffalo Bills",
"teamAbbrev": "BUF",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91541,6 +91543,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Cincinnati Bengals",
"teamAbbrev": "CIN",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91562,6 +91565,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Cleveland Browns",
"teamAbbrev": "CLE",
},
"odds": [],
"quarter": 5,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91583,6 +91587,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Detroit Lions",
"teamAbbrev": "DET",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91604,6 +91609,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Kansas City Chiefs",
"teamAbbrev": "KC",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91625,6 +91631,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New York Jets",
"teamAbbrev": "NYJ",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91646,6 +91653,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Pittsburgh Steelers",
"teamAbbrev": "PIT",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91667,6 +91675,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Carolina Panthers",
"teamAbbrev": "CAR",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -91688,6 +91697,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Los Angeles Chargers",
"teamAbbrev": "LAC",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:05:00.000Z,
},
Expand All @@ -91709,6 +91719,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Philadelphia Eagles",
"teamAbbrev": "PHI",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -91730,6 +91741,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "San Francisco 49ers",
"teamAbbrev": "SF",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -91751,6 +91763,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Seattle Seahawks",
"teamAbbrev": "SEA",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -91772,6 +91785,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Houston Texans",
"teamAbbrev": "HOU",
},
"odds": [],
"quarter": 5,
"startTime": 2018-10-08T00:20:00.000Z,
},
Expand All @@ -91793,6 +91807,7 @@ exports[`2018 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New Orleans Saints",
"teamAbbrev": "NO",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-09T00:15:00.000Z,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100126,7 +100126,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Indianapolis Colts",
"teamAbbrev": "IND",
},
"broadcaster": "FOX/NFL NET",
"broadcaster": "FOX/NFL Net",
"clock": "0:00",
"gameStatus": "Final",
"homeTeam": {
Expand All @@ -100136,6 +100136,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New England Patriots",
"teamAbbrev": "NE",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-05T00:20:00.000Z,
},
Expand All @@ -100157,6 +100158,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Buffalo Bills",
"teamAbbrev": "BUF",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100178,6 +100180,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Cincinnati Bengals",
"teamAbbrev": "CIN",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100199,6 +100202,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Cleveland Browns",
"teamAbbrev": "CLE",
},
"odds": [],
"quarter": 5,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100220,6 +100224,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Detroit Lions",
"teamAbbrev": "DET",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100241,6 +100246,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Kansas City Chiefs",
"teamAbbrev": "KC",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100262,6 +100268,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New York Jets",
"teamAbbrev": "NYJ",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100283,6 +100290,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Pittsburgh Steelers",
"teamAbbrev": "PIT",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100304,6 +100312,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Carolina Panthers",
"teamAbbrev": "CAR",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T17:00:00.000Z,
},
Expand All @@ -100325,6 +100334,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Los Angeles Chargers",
"teamAbbrev": "LAC",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:05:00.000Z,
},
Expand All @@ -100346,6 +100356,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Philadelphia Eagles",
"teamAbbrev": "PHI",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -100367,6 +100378,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "San Francisco 49ers",
"teamAbbrev": "SF",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -100388,6 +100400,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Seattle Seahawks",
"teamAbbrev": "SEA",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-07T20:25:00.000Z,
},
Expand All @@ -100409,6 +100422,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "Houston Texans",
"teamAbbrev": "HOU",
},
"odds": [],
"quarter": 5,
"startTime": 2018-10-08T00:20:00.000Z,
},
Expand All @@ -100430,6 +100444,7 @@ exports[`2022 season client integration tests getNFLGamesForPeriod returns a pop
"team": "New Orleans Saints",
"teamAbbrev": "NO",
},
"odds": [],
"quarter": 4,
"startTime": 2018-10-09T00:15:00.000Z,
},
Expand Down
6 changes: 3 additions & 3 deletions src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Team from '../team/team';

import { flattenObjectSansNumericKeys } from '../utils';

axios.defaults.baseURL = 'https://fantasy.espn.com/apis/v3/games/ffl/seasons/';
axios.defaults.baseURL = 'https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/';

/**
* Provides functionality to make a variety of API calls to ESPN for a given fantasy football
Expand Down Expand Up @@ -170,7 +170,7 @@ class Client {
});

const axiosConfig = this._buildAxiosConfig({
baseURL: 'https://fantasy.espn.com/apis/v3/games/ffl/leagueHistory/'
baseURL: 'https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/leagueHistory/'
});
return axios.get(route, axiosConfig).then((response) => {
const schedule = _.get(response.data[0], 'schedule'); // Data is an array instead of object
Expand Down Expand Up @@ -276,7 +276,7 @@ class Client {
});

const axiosConfig = this._buildAxiosConfig({
baseURL: 'https://fantasy.espn.com/apis/v3/games/ffl/leagueHistory/'
baseURL: 'https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/leagueHistory/'
});

return axios.get(route, axiosConfig).then((response) => (
Expand Down

0 comments on commit 2fef56f

Please sign in to comment.