seemethere / nba_py

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

HTTPError: 503 Server Error: Service Unavailable for url #117

Open justinthe opened 6 years ago

justinthe commented 6 years ago

Hi Guys, When i tried to run this simple script: from nba_py.player import PlayerList, PlayerGameLogs players = PlayerList() it came back to me with this message:

Error Message

_HTTPError Traceback (most recent call last)

in () ----> 1 players = PlayerList() ~\Anaconda3\envs\NBA_PY\lib\site-packages\nba_py\player.py in __init__(self, league_id, season, only_current) 68 params={'LeagueID': league_id, 69 'Season': season, ---> 70 'IsOnlyCurrentSeason': only_current}) 71 72 def info(self): ~\Anaconda3\envs\NBA_PY\lib\site-packages\nba_py\__init__.py in _get_json(endpoint, params, referer) 83 headers=h) 84 # print _get.url ---> 85 _get.raise_for_status() 86 return _get.json() 87 ~\Anaconda3\envs\NBA_PY\lib\site-packages\requests\models.py in raise_for_status(self) 933 934 if http_error_msg: --> 935 raise HTTPError(http_error_msg, response=self) 936 937 def close(self): HTTPError: 503 Server Error: Service Unavailable for url: http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2016-17&IsOnlyCurrentSeason=1_ ### -End of Error Message- I tried to click on the url at the very end of the error message just to check if the URL really was down or not, and it came back fine. Any suggestions of what could be the problems? and what should i do? Thank you, Justin The
rneu31 commented 6 years ago

On my phone so I'm just guessing here but if you paste that url directly into your browser does it return anything? I see the season is set to 2016-17 and IsOnlyCurrentSeason is set to 1 which probably doesn't make sense since the current season isn't 2016-17.

Passing season='2017-18' into your PlayerList call might be enough!

On Sat, Apr 7, 2018, 10:04 AM justinthe notifications@github.com wrote:

Hi Guys, When i tried to run this simple script: from nba_py.player import PlayerList, PlayerGameLogs players = PlayerList() it came back to me with this message: Error Message

_HTTPError Traceback (most recent call last) in () ----> 1 players = PlayerList()

~\Anaconda3\envs\NBA_PY\lib\site-packages\nba_py\player.py in init(self, league_id, season, only_current) 68 params={'LeagueID': league_id, 69 'Season': season, ---> 70 'IsOnlyCurrentSeason': only_current}) 71 72 def info(self):

~\Anaconda3\envs\NBA_PY\lib\site-packages\nbapyinit_.py in _get_json(endpoint, params, referer) 83 headers=h) 84 # print _get.url ---> 85 _get.raise_for_status() 86 return _get.json() 87

~\Anaconda3\envs\NBA_PY\lib\site-packages\requests\models.py in raise_for_status(self) 933 934 if http_error_msg: --> 935 raise HTTPError(http_error_msg, response=self) 936 937 def close(self):

HTTPError: 503 Server Error: Service Unavailable for url: http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2016-17&IsOnlyCurrentSeason=1 _ -End of Error Message-

I tried to click on the url at the very end of the error message just to check if the URL really was down or not, and it came back fine.

Any suggestions of what could be the problems? and what should i do?

Thank you, Justin The

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seemethere/nba_py/issues/117, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpAH9iTYM5ELzzF9dYp0I88C5BFKUq7ks5tmNWKgaJpZM4TLHcp .

justinthe commented 6 years ago

Hi rneu31, thanks for your reply. I paste the url to my browser and it came back with a result, a long list of json text. that was what confused me. i could access it through my browser, but couldn't through my code.

Regards, JThe