def update(): global stations bikestations = citibike.update() threading.Timer(10, update).start()
@app.route('/stormcenters') def get_stormcenters(): global stormcenters return Response(json.dumps(stormcenters), mimetype='application/json') @app.route('/wifi') def get_wifi(): global wifihotspots return Response(json.dumps(wifihotspots), mimetype='application/json') @app.errorhandler(500) def internal_server_error(e): return flask.jsonify(error=500, text=str(e)), 500 def update(): global stations bikestations = citibike.update() threading.Timer(10, update).start() if __name__ == '__main__': # update() bikestations = citibike.update() stormcenters = hurricane.update() wifihotspots = wifi.update() objects = sqlite3.connect('data.db').execute('select * from places order by id desc') places = [dict(id=row[0], name=row[1], lat=row[2], lon=row[3], type=row[4]) for row in objects.fetchall()] places += bikestations app.run(debug=True, host='10.0.1.6')