nba_py icon indicating copy to clipboard operation
nba_py copied to clipboard

Requests from Server

Open nzewail opened this issue 7 years ago • 9 comments

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?

nzewail avatar Nov 01 '17 00:11 nzewail

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

bttmly avatar Nov 01 '17 18:11 bttmly

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

nzewail avatar Nov 01 '17 18:11 nzewail

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.

bttmly avatar Nov 01 '17 23:11 bttmly

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

nzewail avatar Nov 05 '17 04:11 nzewail

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 :/

bttmly avatar Nov 06 '17 18:11 bttmly

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 [email protected]:

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 .

LeatherLeaders avatar Nov 06 '17 22:11 LeatherLeaders

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 for 2016-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.

nzewail avatar Nov 07 '17 00:11 nzewail

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" [email protected]님이 작성:

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 .

LeatherLeaders avatar Nov 07 '17 02:11 LeatherLeaders

Confirmed linode is being blocked as well.

SamCreamer avatar Dec 10 '18 19:12 SamCreamer