Created
March 9, 2015 11:07
-
-
Save joninvski/c2c1a9bdad351c8b2caf to your computer and use it in GitHub Desktop.
Store variable server flask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
from flask import Flask | |
from flask import request | |
from flask import Response | |
app = Flask(__name__) | |
clicked_push=False | |
@app.route('/gcm_proxy', methods=['GET', 'POST']) | |
def clickedPush(): | |
global clicked_push | |
clicked_push = True | |
arg = request.args.get('button_pressed') | |
clicked_push = arg == 'true' | |
return Response("Value: " + str(clicked_push) + ' Passed parameter: ' + str(arg)) | |
@app.route('/read_status', methods=['GET']) | |
def read_status(): | |
global clicked_push | |
r = Response("Value: " + str(clicked_push)) | |
clicked_push = False | |
return r | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0',port=8888, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to daily update the clicked_push variable ? or multiple file how to import it ?