Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats API rejecting traffic from AWS? #41

Closed
toddwschneider opened this issue Apr 5, 2017 · 20 comments
Closed

Stats API rejecting traffic from AWS? #41

toddwschneider opened this issue Apr 5, 2017 · 20 comments

Comments

@toddwschneider
Copy link

About a year ago I wrote a shot chart app in R that uses the the shotchartdetail endpoint: https://github.com/toddwschneider/ballr

Recently my hosted version of the app stopped working. The app still works fine if I run it on my own computer. It seems like the problem is that the Stats API is rejecting requests that come from AWS, where my app is hosted. I've tried tinkering with request headers but haven't been able to make anything work.

Just curious if anyone here has ideas for how to make a request to shotchartdetail from within AWS. Thanks!

@jonathandiep
Copy link

Wow I'm looking over your repo and I'm basically building a very very simple version of what you have!

Anyways, I also have had the same issue with the data not being able to load (both on my Digital Ocean server and when locally with a VPN) , but being also to load the data just fine locally (without VPN). I've had a personal workaround by including this library into my own project, but I'm not sure if you could apply that to your project.

@toddwschneider
Copy link
Author

@jonathandiep I'm a bit confused... are you saying when you use this library (i.e. npm install nba) then you can access the API from within DigitalOcean?

@jonathandiep
Copy link

@toddwschneider Sorry if I was not being clear. I'll try to clarify and let me know if it makes sense.

I originally had a server that used this API to serve data to my front end application. It worked locally, but not on Digital Ocean. So instead of using this library on the server, I used it on my front end application. That way instead of Digital Ocean requesting the NBA data, the front end application will request the NBA data. And for some reason that works 🤔

@toddwschneider
Copy link
Author

@jonathandiep the "front end application" you describe is running on your own local machine, correct? I'm still not sure I understand from your description, but it sounds like you have not been able to request data from stats.nba.com from within DigitalOcean, which is consistent with my inability to request data from within AWS (I also tried DigitalOcean and it didn't work there either)

@gyerli
Copy link

gyerli commented Apr 12, 2017

I had the same issue on my AWS to stats.nba.com communication. I resolved by assigning IPv6 to my EC2 instance and it started to work. I'm not 100% sure that it is coincidence or not.

@jonathandiep
Copy link

@toddwschneider Yeah I haven't been able to request data from stats.nba.com through Digital Ocean. And so my workaround was to implement this NBA API into my front end project itself (I have a React/JavaScript project that makes importing npm packages really easy). This means that any browser that uses my web application will access stats.nba.com directly and that it is not dependent on a server (like AWS/Digital Ocean) to fetch that data.

Also I'm thinking that stats.nba.com is somehow filtering requests, but I'm not too certain about it. Seems like others have been able to successfully retrieve data by modifying the network requests.

@nharrisanalyst
Copy link

Is there any update on this My shot chart app is not working all together wondering if it is a missing header i will try to experiment this week to get things working has my website is unusable at the moment. If I learn anything ill post an update here.

@bttmly
Copy link
Owner

bttmly commented Apr 17, 2017

My strong suspicion is that NBA is blocking known cloud provider IP address blocks. In particular, that would fully account for requests with the exact same headers and parameters appear to work from some hosts and not others. @nharrisanalyst where do you host your app?

@nharrisanalyst
Copy link

I host it on Heroku and I learned from the recent aws outage that it is built on the back of AWS, but recently Stats.NBA is not excepting request from the app when it is locally hosted.

Thanks for the Help too.

@kashav
Copy link

kashav commented Apr 18, 2017

Experiencing a similar problem with kshvmdn/nba.js (kshvmdn/nba.js#16).

Requests seem to be hanging on Heroku/AWS, but working fine on Digital Ocean and Azure.

Local requests started hanging as well, had to make a few header changes for the requests to resolve again.

@nharrisanalyst
Copy link

I got the whole app to work locally hosted and I migrated it to digital ocean but even on digital ocean that stats.nba.com request are hanging

@ghost
Copy link

ghost commented May 29, 2017

Having similar issues. I'm able to hit the endpoint fine locally, but on my ec2 instance it's hanging.

@nharrisanalyst
Copy link

There is no solution on our side it is an issue with the stats.nba.com api.
as frustrating as this is.

@bttmly
Copy link
Owner

bttmly commented Jun 4, 2017

I added a note to the readme with a link to this issue. I'm going to close this issue, nothing we can do to fix it.

@bttmly bttmly closed this as completed Jun 4, 2017
@frankburke333
Copy link

Hi just wondering if anyone has had any luck finding a work around for this issue. I have been searching high and low but don't see that anyone has found a fix but thought I'd check. I am running into the same problem on my heroku rails app....works locally but not from heroku when trying to reach this url:

http://stats.nba.com/stats/leaguedashplayerstats?College=&Conference=&Country=&DateFrom=&DateTo=&Division=&DraftPick=&DraftYear=&GameScope=&GameSegment=&Height=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2017-18&SeasonSegment=&SeasonType=Playoffs&ShotClockRange=&StarterBench=&TeamID=0&VsConference=&VsDivision=&Weight=

Thanks,

Frank

@KZeni
Copy link

KZeni commented Apr 16, 2018

I even managed to get my local IP addressed blocked due to intermittent stat-retrieval testing which met their threshold to get the IP banned (so much for fostering app development).

I can confirm that a VPN works for getting around this IP-based blocking. Unfortunately, I haven't figured out anything more optimal than that.

@toddwschneider
Copy link
Author

@frankburke333 @KZeni I have not

I did put together this app to collect all shots into a database: https://github.com/toddwschneider/nba-shots-db. But again, it only works from my local machine, not AWS

@frankburke333
Copy link

Thanks so much for the responses guys. It's such a frustrating API to work with for so many reasons. I'll try out the VPN option. Todd, great job on the site. Long live the mid-range jumper! :) The attack on this shot is in fashion but its no coincidence that every great player you can name over the last 20 years feasted in the midrange (Kobe, KD, Wade, Lebron etc.).

@mert-kurttutan
Copy link

mert-kurttutan commented May 29, 2022

For those who want to collect data by just running jupyter notebook on the cloud, one alternative is google colab. I checked with several different urls, it seems to work

@dmackerman
Copy link

This still appears to be the case. I tried writing a simple Express server and hosting it on Netlify. Just using Functions only, simple little app. The requests all time out, presumably because they use AWS infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants