Closed worldofnick closed 6 years ago
NBA.com seems to block known IP address blocks from cloud hosting providers, including AWS and Heroku
@bttmly Do you know of anyway to get around this?
Many endpoints allow a JSONP API, which can be accessed directly by a web client. When you do that, the requesting IP address is that of the client's own computer, so you circumvent this restriction. This would mean your app would have to run in the browser though; not sure what your use case is.
Otherwise you can host your application on a provider that NBA doesn't block. I just ran a request to NBA through a Node.js client from a server hosted by Linode and it worked (disclaimer: I couldn't get a similar curl
command to work, no idea why).
Shameless plug: I wrote a Node.js/browser NBA client in JavaScript which supports JSONP: https://github.com/bttmly/nba
EDIT: Not sure if the npm
installation of that package currently supports browsers. Ping me if you need help on that
Has anyone sucecssfully deplpyed a flask app that uses nba_py? I have used Heroku and pythonanywhere and both times it doesn't work when I try to request game information. It just times out.
On Heroku when I open the command line and type
scoreboard = nba_py.Scoreboard(month=2, day=21, year=2015)
the command never executes just hangs there.