nba_py icon indicating copy to clipboard operation
nba_py copied to clipboard

Current season is last season

Open noelvillaman opened this issue 6 years ago • 7 comments

How do I make the current season to be up-to-date? When I print from constants.CurrentSeason or so, it return last years.

noelvillaman avatar Jan 01 '18 05:01 noelvillaman

What are you trying to do?

You can pass the season along to any function/method yourself.

players = PlayerList(season='2017-18').info().DISPLAY_LAST_COMMA_FIRST

rneu31 avatar Jan 15 '18 16:01 rneu31

I tried ecxacly that and it does not return anything. I am tryinv to get the actual roster. Melo is still a Knick. I also want to get the results of games.

Noel

On Jan 15, 2018 11:03 AM, "Randy" [email protected] wrote:

What are you trying to do?

You can pass the season along to any function/method yourself.

players = PlayerList(season='2017-18').info().DISPLAY_LAST_COMMA_FIRST

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/seemethere/nba_py/issues/103#issuecomment-357724034, or mute the thread https://github.com/notifications/unsubscribe-auth/AE7dmpod2IKFDIPEZKwtQDu8wWI0KWOJks5tK3bKgaJpZM4RP_kt .

noelvillaman avatar Jan 16 '18 22:01 noelvillaman

The code I shared was the code that would work if using Pandas. Can you show me exactly what you tried? I can help.

rneu31 avatar Jan 24 '18 19:01 rneu31

Hi again,

this is what I am trying to do, and I do not thing I using Pandas.

game1 = game.BoxscoreSummary(20180131, '2017-18')

Traceback (most recent call last): File "", line 1, in File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/nba_py/game.py", line 25, in init 'EndRange': end_range}) File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/nba_py/init.py", line 85, in _get_json _get.raise_for_status() File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/requests/models.py", line 935, 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/boxscoresummaryv2?StartRange=0&GameID=20180131&EndPeriod=0&RangeType=0&Season=2017-18&StartPeriod=0&SeasonType=Regular+Season&EndRange=0

game1 = game.BoxscoreSummary(20180131) Traceback (most recent call last): File "", line 1, in File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/nba_py/game.py", line 25, in init 'EndRange': end_range}) File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/nba_py/init.py", line 85, in _get_json _get.raise_for_status() File "/home/namalliv/virtualenv/namasite/2.7/lib/python2.7/site-packages/requests/models.py", line 935, 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/boxscoresummaryv2?StartRange=0&GameID=20180131&EndPeriod=0&RangeType=0&Season=2016-17&StartPeriod=0&SeasonType=Regular+Season&EndRange=0

So, I am trying to get the information of this season. I would like to see the summary of lastnight game. How would do it?

Thanks,

Noel.

noelvillaman avatar Feb 01 '18 16:02 noelvillaman

Your GameID parameter looks malformed -- they are always 10 digits. NBA provides pretty good error responses -- open this in your browser: http://stats.nba.com/stats/boxscoresummaryv2?StartRange=0&GameID=20180131&EndPeriod=0&RangeType=0&Season=2017-18&StartPeriod=0&SeasonType=Regular+Season&EndRange=0

warriors/jazz game from the other night, on NBA website:

http://stats.nba.com/game/0021700751/

matching API request:

http://stats.nba.com/stats/boxscoresummaryv2?StartRange=0&GameID=0021700751&EndPeriod=0&RangeType=0&Season=2016-17&StartPeriod=0&SeasonType=Regular+Season&EndRange=0

where did you get the id 20180131 from?

bttmly avatar Feb 01 '18 23:02 bttmly

That was my mistake, I got it from a date in the url: http://www.nba.com/games/20180201/MEMDET#/video I am getting good things now.

noelvillaman avatar Feb 02 '18 01:02 noelvillaman

If you want the current season to be global, go to constants and change current_season to ‘2017-18’. It’s the first line in the script.

BenikaH avatar Feb 19 '18 13:02 BenikaH