seemethere / nba_py

Python client for NBA statistics located at stats.nba.com
BSD 3-Clause "New" or "Revised" License
1.05k stars 256 forks source link

HTTPError 400 Client Error when testing BoxScoreSummary #97

Open PHironaka opened 6 years ago

PHironaka commented 6 years ago

I'm trying post box score summary updates in my django app I'm working on. As a test, I've copied the boxscore summary code from game.py just to test the json output.

I haven't been able to get it to work, this is the URL that gets outputted: http://stats.nba.com/stats/boxscoresummaryv2?Season=2016-17&SeasonType=Regular+Season&RangeType=0&StartPeriod=0&EndPeriod=0&StartRange=0&EndRange=0

For some reason the game_id isn't registering.

`class BoxscoreSummary: _endpoint = 'boxscoresummaryv2'

def __init__(self,
             game_id,
             season=constants.CURRENT_SEASON,
             season_type=constants.SeasonType.Default,
             range_type=constants.RangeType.Default,
             start_period=constants.StartPeriod.Default,
             end_period=constants.EndPeriod.Default,
             start_range=constants.StartRange.Default,
             end_range=constants.EndRange.Default):
    self.json = _get_json(endpoint=self._endpoint,
                          params={'GameID': game_id,
                                  'Season': season,
                                  'SeasonType': season_type,
                                  'RangeType': range_type,
                                  'StartPeriod': start_period,
                                  'EndPeriod': end_period,
                                  'StartRange': start_range,
                                  'EndRange': end_range})

def game_summary(self):
    return _api_scrape(self.json, 0)

def other_stats(self):
    return _api_scrape(self.json, 1)

def officials(self):
    return _api_scrape(self.json, 2)

def inactive_players(self):
    return _api_scrape(self.json, 3)

def game_info(self):
    return _api_scrape(self.json, 4)

def line_score(self):
    return _api_scrape(self.json, 5)

def last_meeting(self):
    return _api_scrape(self.json, 6)

def season_series(self):
    return _api_scrape(self.json, 7)

def available_video(self):
    return _api_scrape(self.json, 8)`