Created
June 5, 2015 00:31
-
-
Save jperla/e243102edc783941d825 to your computer and use it in GitHub Desktop.
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
| from flask import Flask | |
| from flask import request | |
| app = Flask(__name__) | |
| db = {} | |
| @app.route('/set') | |
| def set(): | |
| if len(request.args) > 0: | |
| key = request.args.keys()[0] | |
| db[key] = request.args[key] | |
| return '%s=%s' % (key, db[key]) | |
| else: | |
| return 'no key set' | |
| @app.route('/get') | |
| def get(): | |
| key = request.args.get('key', '') | |
| print db | |
| return '%s=%s' % (key, db.get(key)) | |
| if __name__ == '__main__': | |
| app.run(port=4000, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment