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

Requests from Server #96

Open nzewail opened 6 years ago

nzewail commented 6 years ago

Trying to create a web application using nba_py, and am unable to make a request from heroku. When I make a request, it just hangs. Is there any workaround to getting the stats.nba.com API to accept requests from a server?

bttmly commented 6 years ago

You need to host it somewhere else; NBA.com blocks IP addresses from cloud hosting providers (AWS, Heroku, several others). Or route your traffic through a VPN or similar. I've had success accessing it from a server hosted by Linode (https://www.linode.com/) which is a much smaller provider

nzewail commented 6 years ago

Ok. I'll try hosting on linode. That's really stupid though. Why does the NBA block those IP addresses?

bttmly commented 6 years ago

To make it painful for people trying to do exactly what we're trying to – build & deploy apps using their API. I figure its a blunt solution, and doesn't work all that well, but its dead simple on their end to implement.

nzewail commented 6 years ago

attempted to make a request through linode and it is giving me the same issue 😭

bttmly commented 6 years ago

Oof. I'll check this evening and see if Linode is still working for me. What type of application are you building? Another possible workaround (but its a major change) is to offload all the API requests to the browser using the JSONP API. This would mean rewriting your app in JS though (or using something like https://github.com/QQuick/Transcrypt to transpile python to JS). I maintain a JS NBA client (https://github.com/bttmly/nba) that works in the browser, although not all of their endpoints support JSONP :/

LeatherLeaders commented 6 years ago

Hi I'm Korean University student. I have a term-project for data science. I dont know about what you say 'JS', 'Linod' 'how to use JSONP API' etc... I dont know well about programming . I just want to get NBA data about games, Teams, Players... And then save this data to DBMS(MySQL) , analyze this data for prediction. I searched the data at "https://www.mysportsfeeds.com" but i couldnt get data because of bugs. And this site can't get current 17-18 season data.

I dont know what to do . This repository is right to me? or I should find another repository? Help me :[

2017-11-07 3:52 GMT+09:00 Nick Bottomley notifications@github.com:

Oof. I'll check this evening and see if Linode is still working for me. What type of application are you building? Another possible workaround (but its a major change) is to offload all the API requests to the browser using the JSONP API. This would mean rewriting your app in JS though (or using something like https://github.com/QQuick/Transcrypt to transpile python to JS). I maintain a JS NBA client (https://github.com/bttmly/nba) that works in the browser, although not all of their endpoints support JSONP :/

— 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/96#issuecomment-342247926, or mute the thread https://github.com/notifications/unsubscribe-auth/Af3XsLDUhkBhj4vTcT-CJGYuuF2iB4D-ks5sz1V-gaJpZM4QNm7y .

nzewail commented 6 years ago

You should be able to get this data from this API and store the results in a MySQL DB. The API can get current data you just need to set the season parameter in your request to 2017-18'. The default is for2016-17`. The issue we are discussing is making requests from a server for web applications. That is a different problem than the one you are having.

LeatherLeaders commented 6 years ago

Thanks for your reply I think i cant use this API for web application. My plan is making website which can predict game winner using machine learning .

      1. 오전 9:42에 "Nabeel Zewail" notifications@github.com님이 작성:

You should be able to get this data from this API and store the results in a MySQL DB. The API can get current data you just need to set the season parameter in your request to 2017-18'. The default is for2016-17`. The issue we are discussing is making requests from a server for web applications. That is a different problem than the one you are having.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/seemethere/nba_py/issues/96#issuecomment-342336932, or mute the thread https://github.com/notifications/unsubscribe-auth/Af3XsEG91SUuT7vWLnhWN7B4yU-LdmGBks5sz6dugaJpZM4QNm7y .

SamCreamer commented 5 years ago

Confirmed linode is being blocked as well.