Forums

Flask app times out

I am trying to make a flask app which uses the python library nba_py. I believe this library makes some web requests to pull down nba game data.

For example when I have a route that looks like this

@app.route('/games/', methods=['GET'])
def get_games():
    scoreboard = nba_py.Scoreboard(month=2, day=21, year=2015)
    return jsonify({'message': 'test'})

When I go to my route it just hangs and then eventually gives up. I'm not exactly sure what is going on behind the scenes of nba_py but does anyone have any idea why this might be timing out? The routes work perfectly on my local machine. I also tried executing scoreboard = nba_py.Scoreboard(month=2, day=21, year=2015) in the python shell and the command never executes it just hangs.

I see you upgraded your account earlier on today -- thanks! Have you reloaded your website since then? And is the Python shell one you started after you upgraded? If not, it's possible that some of your code is still running with the old free settings.

Hi, I just tried with a new shell in Python 2.7 and am seeing the same results. This might be an issue with nba_py as I am getting in Heroku too.

Ah, right. Yes, that might be it. Some sites don't like being accessed from cloud computing environments like AWS, which is where we (and I think Heroku, though I'm not sure) are based. So it's possible that nba_py is, behind the scenes, accessing a site that blocks us.