示例#1
0
def test():
    team_id = TEAMS['ATL']['id']
    player_id = get_player('Lebron', 'James')
    assert team.TeamList()
    assert team.TeamSummary(team_id)
    team_details = team.TeamDetails(team_id)
    assert team_details
    assert team_details.background()
    assert team_details.history()
    assert team.TeamCommonRoster(team_id)
    assert team.TeamGeneralSplits(team_id)
    assert team.TeamOpponentSplits(team_id)
    assert team.TeamLastNGamesSplits(team_id)
    assert team.TeamInGameSplits(team_id)
    assert team.TeamClutchSplits(team_id)
    assert team.TeamShootingSplits(team_id)
    assert team.TeamPerformanceSplits(team_id)
    assert team.TeamLineups(team_id)
    assert team.TeamPlayers(team_id)
    assert team.TeamPlayerOnOffDetail(team_id)
    assert team.TeamPlayerOnOffSummary(team_id)
    assert team.TeamGameLogs(team_id)
    assert team.TeamShotTracking(team_id)
    assert team.TeamReboundTracking(team_id)
    assert team.TeamPassTracking(team_id)
    assert team.TeamVsPlayer(team_id, player_id)
 def testAll(self):
     assert team.TeamList()
     assert team.TeamSummary(self.teamId)
     team_details = team.TeamDetails(self.teamId)
     assert team_details
     # assert team_details.background()
     # assert team_details.history()
     assert team.TeamCommonRoster(self.teamId)
     assert team.TeamGeneralSplits(self.teamId)
     assert team.TeamOpponentSplits(self.teamId)
     assert team.TeamLastNGamesSplits(self.teamId)
     assert team.TeamInGameSplits(self.teamId)
     assert team.TeamClutchSplits(self.teamId)
     assert team.TeamShootingSplits(self.teamId)
     assert team.TeamPerformanceSplits(self.teamId)
     assert team.TeamLineups(self.teamId)
     assert team.TeamPlayers(self.teamId)
     assert team.TeamPlayerOnOffDetail(self.teamId)
     assert team.TeamPlayerOnOffSummary(self.teamId)
     assert team.TeamGameLogs(self.teamId)
     assert team.TeamShotTracking(self.teamId)
     assert team.TeamReboundTracking(self.teamId)
     assert team.TeamPassTracking(self.teamId)
     assert team.TeamVsPlayer(self.teamId, self.playerId)
示例#3
0
import nba_py
import sys
import webbrowser
import os
from nba_py import team as team
from nba_py import constants as constants

teams = constants.TEAMS

teamAbbrev = sys.argv[1]

singleTeam = teams[teamAbbrev]

teamID = singleTeam["id"]

teamShootingSplits = team.TeamShootingSplits(teamID).shot_areas()

print json.dumps(singleTeam, indent=4)
print(teamID)
print json.dumps(teamShootingSplits, indent=4)

teamInfo = team.TeamSummary(teamID).info()
print json.dumps(teamInfo, indent=4)

with open('teamShots.json', 'w') as f:
    f.write("teamShots='" + json.dumps(teamShootingSplits) + "'")

with open('teamInfo.json', 'w') as f:
    f.write("teamInfo='" + json.dumps(teamInfo) + "'")

webbrowser.open("file://" + os.path.realpath("team.html"))
示例#4
0
def print_team_information(team_choice):
    # print(team_choice)
    try:
        team_id = team_ids[team_choice]
    except:
        print("Invalid team.")
        print()
        print()
        return
    # print(team_id)
    print('1. View Team Roster')
    print('2. View Team Coaches')
    print('3. View Championship History')
    print('4. View Hall of Fame History')
    print('5. View Retired Jerseys')
    print('6. View Season Totals for Team\'s Players')
    print('7. View Shooting Splits by Area')
    print('8. View Season Totals for 2017-18')
    print('9. Go back to main menu')

    team_info_choice = input("What information about " + team_choice + " would you like to view?\n")

    teamdetails = team.TeamDetails(team_id)

    if int(team_info_choice) == 1:
        teamcommonroster = team.TeamCommonRoster(team_id, season='2017-18')
        printer.pprint(teamcommonroster.roster())

    elif int(team_info_choice) == 2:
        teamcommonroster = team.TeamCommonRoster(team_id, season='2017-18')
        printer.pprint(teamcommonroster.coaches())

    elif int(team_info_choice) == 3:
        # teamdetails = team.TeamDetails(team_id)
        printer.pprint(teamdetails.awards_championships())

    elif int(team_info_choice) == 4:
        # teamdetails = team.TeamDetails(team_id)
        printer.pprint(teamdetails.hof())

    elif int(team_info_choice) == 5:
        # teamdetails == team.TeamDetails(team_id)
        printer.pprint(teamdetails.retired())

    elif int(team_info_choice) == 6:
        teamplayers = team.TeamPlayers(team_id, season='2017-18')
        printer.pprint(teamplayers.season_totals())
        # printer.pprint(teamdetails.social_sites())

    elif int(team_info_choice) == 7:
        shooting = team.TeamShootingSplits(team_id)
        printer.pprint(shooting.shot_areas())

    elif int(team_info_choice) == 8:
        sum = team.TeamSummary(team_id, season='2017-18')
        printer.pprint(sum.season_ranks())

    elif int(team_info_choice) == 9:
        return

    else:
        print("Invalid menu choice")