Skip to content

Instantly share code, notes, and snippets.

@joninvski
Created March 9, 2015 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joninvski/c2c1a9bdad351c8b2caf to your computer and use it in GitHub Desktop.
Save joninvski/c2c1a9bdad351c8b2caf to your computer and use it in GitHub Desktop.
Store variable server flask
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)
@sqxccdy
Copy link

sqxccdy commented Jun 28, 2016

how to daily update the clicked_push variable ? or multiple file how to import it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment