stats/play_by_play.py
def fetch_game(self, game_id):
        """
        Build GET REST request to the NBA for a game, iterate over
        the results and return them.
        """
        params = self.build_params(game_id)

        # Encode without safe '+', apparently the NBA likes unsafe url params.
        params_str = urllib.parse.urlencode(params, safe=':+')

        response = requests.get(url=self.url, headers=headers, params=params_str).json()

        # pulling just the data we want
        player_info = response['resultSets'][0]['rowSet']

        rows = []

        # looping over data to return.
        for row in player_info:
            new_row = {
                'game_id': row[0],
                'event_num': row[1],
                'event_msg_type': row[2],
                'event_msg_action_type': row[3],
                'period': row[4],
                'wc_time': row[5],
                'home_description': row[7],
                'neutral_description': row[8],
                'visitor_description': row[9],
                'score': row[10],
                'score_margin': row[11],
                'player1_id': self.get_null_id(row[13]),
                'player1_team_id': self.get_null_id(row[15]),
                'player2_id': self.get_null_id(row[20]),
                'player2_team_id': self.get_null_id(row[22]),
                'player3_id': self.get_null_id(row[27]),
                'player3_team_id': self.get_null_id(row[29])
            }

            rows.append(new_row)
        return rows

        Build GET REST request to the NBA for a game, iterate over
        the results and return them.
        
Build GET REST request to the NBA for a game, iterate over
the results and return them.
Build GET REST request to the NBA for a game iterate over the results and return them .
def fetch_game(self, game_id):
        params = self.build_params(game_id)
        params_str = urllib.parse.urlencode(params, safe=':+')
        response = requests.get(url=self.url, headers=headers, params=params_str).json()
        player_info = response['resultSets'][0]['rowSet']
        rows = []
        for row in player_info:
            new_row = {
                'game_id': row[0],
                'event_num': row[1],
                'event_msg_type': row[2],
                'event_msg_action_type': row[3],
                'period': row[4],
                'wc_time': row[5],
                'home_description': row[7],
                'neutral_description': row[8],
                'visitor_description': row[9],
                'score': row[10],
                'score_margin': row[11],
                'player1_id': self.get_null_id(row[13]),
                'player1_team_id': self.get_null_id(row[15]),
                'player2_id': self.get_null_id(row[20]),
                'player2_team_id': self.get_null_id(row[22]),
                'player3_id': self.get_null_id(row[27]),
                'player3_team_id': self.get_null_id(row[29])
            }
            rows.append(new_row)
        return rows
def fetch_game ( self , game_id ) : params = self . build_params ( game_id ) params_str = urllib . parse . urlencode ( params , safe = ':+' ) response = requests . get ( url = self . url , headers = headers , params = params_str ) . json ( ) player_info = response [ 'resultSets' ] [ 0 ] [ 'rowSet' ] rows = [ ] for row in player_info : new_row = { 'game_id' : row [ 0 ] , 'event_num' : row [ 1 ] , 'event_msg_type' : row [ 2 ] , 'event_msg_action_type' : row [ 3 ] , 'period' : row [ 4 ] , 'wc_time' : row [ 5 ] , 'home_description' : row [ 7 ] , 'neutral_description' : row [ 8 ] , 'visitor_description' : row [ 9 ] , 'score' : row [ 10 ] , 'score_margin' : row [ 11 ] , 'player1_id' : self . get_null_id ( row [ 13 ] ) , 'player1_team_id' : self . get_null_id ( row [ 15 ] ) , 'player2_id' : self . get_null_id ( row [ 20 ] ) , 'player2_team_id' : self . get_null_id ( row [ 22 ] ) , 'player3_id' : self . get_null_id ( row [ 27 ] ) , 'player3_team_id' : self . get_null_id ( row [ 29 ] ) } rows . append ( new_row ) return rows
Build GET REST request to the NBA for a game, iterate over
the results and return them.
Build GET REST request to the NBA for a game iterate over the results and return them .
"""
        Build GET REST request to the NBA for a game, iterate over
        the results and return them.
        """ # Encode without safe '+', apparently the NBA likes unsafe url params. # pulling just the data we want # looping over data to return.
self
game_id