From 85fdeeed434d29ceba4882161e5681770dbfe74c Mon Sep 17 00:00:00 2001 From: Bob Ambrose Date: Mon, 3 Jan 2022 17:17:03 -0500 Subject: [PATCH 1/2] add a weekly game lines feed to the python API --- ohmysportsfeedspy/v2_1.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ohmysportsfeedspy/v2_1.py b/ohmysportsfeedspy/v2_1.py index 2ff2f18..dec9f0d 100644 --- a/ohmysportsfeedspy/v2_1.py +++ b/ohmysportsfeedspy/v2_1.py @@ -48,6 +48,7 @@ def __init__(self, verbose, store_type=None, store_location=None): 'seasonal_standings', 'seasonal_game_lines', 'daily_game_lines', + 'weekly_game_lines', 'daily_futures' ] @@ -240,6 +241,14 @@ def determine_url(self, league, season, feed, output_format, params): return "{base_url}/{league}/{season}/date/{date}/odds_gamelines.{output}".format(base_url=self.base_url, league=league, season=season, date=params["date"], output=output_format) + elif feed == "weekly_game_lines": + if season == "": + raise AssertionError("You must specify a season for this request") + if not "week" in params: + raise AssertionError("You must specify a 'week' param for this request.") + week = params['week'] + return f"{self.base_url}/{league}/{season}/week/{week}/odds_gamelines.{output_format}" + elif feed == "daily_futures": if season == "": raise AssertionError("You must specify a season for this request.") From 10ac2b312f833d5c5e067ad9df2718951ae42874 Mon Sep 17 00:00:00 2001 From: Bob Ambrose Date: Mon, 3 Jan 2022 17:29:46 -0500 Subject: [PATCH 2/2] only let the weekly_game_lines be available for NFL league type --- ohmysportsfeedspy/v2_1.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ohmysportsfeedspy/v2_1.py b/ohmysportsfeedspy/v2_1.py index dec9f0d..e236ac6 100644 --- a/ohmysportsfeedspy/v2_1.py +++ b/ohmysportsfeedspy/v2_1.py @@ -246,6 +246,8 @@ def determine_url(self, league, season, feed, output_format, params): raise AssertionError("You must specify a season for this request") if not "week" in params: raise AssertionError("You must specify a 'week' param for this request.") + if league != "nfl": + raise AssertionError("weekly_game_lines feed type only avaiable for the NFL") week = params['week'] return f"{self.base_url}/{league}/{season}/week/{week}/odds_gamelines.{output_format}"