def _games_in_week(year, week, kind='REG'): """ A list for the games matching the year/week/kind parameters. The kind parameter specifies whether to fetch preseason, regular season or postseason games. Valid values are PRE, REG and POST. """ return nflgame._search_schedule(year, week, kind=kind)
def run_population(): season = nbmodels.Season.objects.latest('start_date') for week_num in range(1,18): week_matchs = nflgame._search_schedule(datetime.datetime.today().year,week=week_num) for match in week_matchs: home_team = nbmodels.Team.objects.get(abbreviation=match['home']) away_team = nbmodels.Team.objects.get(abbreviation=match['away']) week = 'week' + str(week_num) nsmodels.Matchup.objects.create(season=season,away_team=away_team,home_team=home_team,week=week)
def load_schedule_info(season, week, team): #Condition to deal with game.schedule.home='JAX' but game.data.home='JAC' in 2016 week 1 team = 'JAX' if int(season) == 2016 and int( week) == 1 and team in ['JAC', 'JAX'] else team game_info = nflgame._search_schedule(int(season), int(week), home=team, away=team, kind='REG') if len(game_info) == 0: return 'bye' if len(game_info) == 1: return game_info[0]['eid']