You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
Traceback (most recent call last):
File "C:/Users/Troy/PycharmProjects/nbastats/nbaStatsLebron.py", line 29, in
test()
File "C:/Users/Troy/PycharmProjects/nbastats/nbaStatsLebron.py", line 6, in test
pid = get_player('Tim', 'Duncan')
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py\player.py", line 11, in get_player
pl = PlayerList(season=season, only_current=only_current).info()
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py\player.py", line 28, in init
'IsOnlyCurrentSeason': only_current})
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py__init__.py", line 42, in _get_json
_get.raise_for_status()
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://stats.nba.com/stats/commonallplayers/?LeagueID=00&IsOnlyCurrentSeason=0&Season=2014-15
Is there something that I need to setup in order for this to work?
The text was updated successfully, but these errors were encountered:
stats.nba.com is rejecting the Python User Agent but this has been fixed by emulating a normal browser HEADERS = {'user-agent': ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/45.0.2454.101 Safari/537.36'), 'referer': 'http://stats.nba.com/scores/' }
Uninstall nba_py, clone latest source code from master branch and reinstall. Installing via pip gave me the same error.
Below are the errors I am getting from the tests folder:
from nba_py import player
from nba_py.player import get_player
def test():
pid = get_player('Tim', 'Duncan')
vs_pid = get_player('Stephen', 'Curry')
assert player.PlayerList()
assert player.PlayerSummary(pid)
assert player.PlayerGeneralSplits(pid)
assert player.PlayerOpponentSplits(pid)
assert player.PlayerLastNGamesSplits(pid)
assert player.PlayerInGameSplits(pid)
assert player.PlayerClutchSplits(pid)
assert player.PlayerShootingSplits(pid)
assert player.PlayerPerformanceSplits(pid)
assert player.PlayerYearOverYearSplits(pid)
assert player.PlayerCareer(pid)
assert player.PlayerProfile(pid)
assert player.PlayerGameLogs(pid)
assert player.PlayerShotTracking(pid)
assert player.PlayerReboundTracking(pid)
assert player.PlayerPassTracking(pid)
assert player.PlayerDefenseTracking(pid)
assert player.PlayerShotLogTracking(pid)
assert player.PlayerReboundLogTracking(pid)
assert player.PlayerVsPlayer(pid, vs_pid)
test()
Traceback (most recent call last):
File "C:/Users/Troy/PycharmProjects/nbastats/nbaStatsLebron.py", line 29, in
test()
File "C:/Users/Troy/PycharmProjects/nbastats/nbaStatsLebron.py", line 6, in test
pid = get_player('Tim', 'Duncan')
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py\player.py", line 11, in get_player
pl = PlayerList(season=season, only_current=only_current).info()
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py\player.py", line 28, in init
'IsOnlyCurrentSeason': only_current})
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nba_py__init__.py", line 42, in _get_json
_get.raise_for_status()
File "C:\Users\Troy\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://stats.nba.com/stats/commonallplayers/?LeagueID=00&IsOnlyCurrentSeason=0&Season=2014-15
Is there something that I need to setup in order for this to work?
The text was updated successfully, but these errors were encountered: