Example #1
0
    def test_league_box_scores(self):
        league = League(411647, 2019)
        final_matchup = league.box_scores()[0]
        middle_matchup = league.box_scores(matchup_period=7)[0]
        # same matchup period but single scoring period
        scoring_period_matchup = league.box_scores(scoring_period=48, matchup_total=False)[0]

        self.assertEqual(final_matchup.home_score, 4240.0)
        self.assertEqual(final_matchup.away_lineup[0].points, 156.0)

        self.assertEqual(middle_matchup.home_score, 1234.0)
        self.assertEqual(middle_matchup.away_lineup[0].points, 12.5)

        self.assertEqual(scoring_period_matchup.home_score, 234.0)
        self.assertEqual(scoring_period_matchup.away_lineup[0].points, 0)
Example #2
0
    'swid': '{9404E72D-02B1-41C9-84E7-2D02B191C9FC}'
}

league = League(league_id=79672,
                year=2022,
                espn_s2=cookies['espn_s2'],
                swid=cookies['swid'])
teams = league.teams

day = datetime.datetime.today()
#day = datetime.datetime(2021, 11, 29)
start, end = getStartEnd(day)
week = getWeekNumber(day)
current_week = league.current_week
matchups = league.scoreboard(week)
box_scores = league.box_scores()  # box_scores class
weekly_schedule = getWeeklySchedule(start, end, cookies, PRO_TEAM_MAP)
projections = {}

# Loop over teams
for team in league.teams:
    daily_points = [0] * 7
    n_games_week = []
    home = False
    current_score = getCurrentScore(team.team_name, box_scores)
    # Loop over days in week
    for i in range(day.weekday(), 7):
        player_points = []
        n_games_day = 0
        # Loop over players
        for player in team.roster:
Example #3
0
from espn_api.basketball import League
import json


LEAGUE_ID = 2142217092
YEAR = 2021
ESPN_2 = "AECox3HQX41Ekc%2Bjyoa6Vj4bWoIqI3uhRpyMRAhNIDKCary6Q3Q0IFToSQahGqCar%2F%2BaJq0UlQs%2B%2BoHjndhneXswVf%2BF1zLbBbJ2AwKd%2F1hZUY1Kjv884%2FElh4e19tNeK9DqAAyr9GYWJ0Fw5Z%2FUYKWdI48gCD1rR4CjKiZgpTqgk1Tm9ifkfC0TyzDYa%2Bda4a4VvLdsS6hYMuvCJm9acLENgXYBTqvZqBeOm7UySYVCw8lqwyjacW8gnpcw6T9igzOTlDxsjW6uYhu1yvbSvTp7"
SWID = "0FA8E20F-267F-4A5E-9630-7D28BABEF81C"

with open('server/schedule.json') as file:
    schedule = json.load(file)



league = League(league_id=2142217092, year = 2021, espn_s2=ESPN_2, swid=SWID)
box = league.box_scores()
week  = league.get_team_data(1).wins + league.get_team_data(1).losses + league.get_team_data(1).ties + 3
total_games = week - 3
matchups = league.scoreboard(week)
print(matchups)
team_points = {
    1: 0,
    2: 0,
    3: 0,
    4: 0,
    5: 0,
    6: 0

}

team_names = {