예제 #1
0
 def retrieveShotsFromUrl(self):
     """
     Retrieve shot information for game from ESPN URL.
     """
     try:
         url = nba_shots + str(self.game_id)
         if self.verbose: print(url)
         shots = retrieveEspnNbaData.dataFromUrl(url, 'shots', self.game_id)
     except ValueError:
         # need some stuff to spit out error info...
         print('Failed to retreive shot locations for game ' + str(gameid))
         shots = list()
     self.shots = shots
예제 #2
0
    def retrievePBPFromUrl(self):
        """
        Retrieve play-by-play data for game from ESPN URL.
        """

        try:
            url = nba_pbp + str(self.game_id) + "&period=0"
            if self.verbose: print(url)
            pbp = retrieveEspnNbaData.dataFromUrl(url, 'pbp', self.game_id)
        except ValueError:
            # need some stuff to spit out error info...
            print('Failed to retreive play-by-play for game ' + str(gameid))
            pbp = dict()
        self.play_by_play = pbp
예제 #3
0
 def retrieveShotsFromUrl(self):
     """
     Retrieve shot information for game from ESPN URL.
     """
     try:
         url = nba_shots + str(self.game_id)
         if self.verbose: print(url)
         shots = retrieveEspnNbaData.dataFromUrl(url,
                                                 'shots',
                                                 self.game_id)
     except ValueError:
         # need some stuff to spit out error info...
         print('Failed to retreive shot locations for game ' + str(gameid))
         shots = list()
     self.shots = shots
예제 #4
0
 def retrievePBPFromUrl(self):
     """
     Retrieve play-by-play data for game from ESPN URL.
     """
     
     try:
         url = nba_pbp + str(self.game_id)
         pbp = retrieveEspnNbaData.dataFromUrl(url,
                                               'pbp',
                                               self.game_id)
     except ValueError:
         # need some stuff to spit out error info...
         print('Failed to retreive play-by-play for game ' + str(gameid))
         pbp = dict()
     self.play_by_play = pbp
예제 #5
0
    def retrieveRecapFromUrl(self):
        """
        Retreive recap / summary data for game from ESPN URL.
        """

        try:
            url = nba_ext + str(self.game_id)
            if self.verbose: print(url)
            ext = retrieveEspnNbaData.dataFromUrl(url, 'ext', self.game_id)
        except ValueError:
            # need some stuff to spit out error info...
            print('Failed to retreive recap for game ' +\
                  str(self.game_id))
            ext = dict()
        self.recap = ext
예제 #6
0
    def retrieveBoxScoreFromUrl(self):
        """
        Retrieve box score information for game from ESPN URL.
        """

        try:
            url = nba_box + str(self.game_id)
            if self.verbose: print(url)
            box = retrieveEspnNbaData.dataFromUrl(url, 'box', self.game_id)
            self.player_stats = box['player_info']
            self.game_stats = box['game_info']
        except ValueError:
            # need some stuff to spit out error info...
            print('Failed to retreive box score for game ' + str(gameid))
            box = dict()
예제 #7
0
 def retrieveRecapFromUrl(self):
     """
     Retreive recap / summary data for game from ESPN URL.
     """
     
     try:
         url = nba_ext + str(self.game_id)
         if self.verbose: print(url)
         ext = retrieveEspnNbaData.dataFromUrl(url,
                                               'ext',
                                               self.game_id)
     except ValueError:
         # need some stuff to spit out error info...
         print('Failed to retreive recap for game ' +\
               str(self.game_id))
         ext = dict()
     self.recap = ext
예제 #8
0
 def retrieveBoxScoreFromUrl(self):
     """
     Retrieve box score information for game from ESPN URL.
     """
     
     try:
         url = nba_box + str(self.game_id)
         if self.verbose: print(url)
         box = retrieveEspnNbaData.dataFromUrl(url,
                                               'box',
                                               self.game_id)
         if box:
             self.player_stats = box['player_info']
             self.game_stats = box['game_info']
         else:
             self.player_stats = {}
             self.game_stats = {}
     except ValueError:
         # need some stuff to spit out error info...
         print('Failed to retreive box score for game ' + str(gameid))
         box = dict()