Skip to content

Instantly share code, notes, and snippets.

@rdeioris
Created April 1, 2019 18:03
Show Gist options
  • Save rdeioris/1235d6f30204f812babfff94dcf77863 to your computer and use it in GitHub Desktop.
Save rdeioris/1235d6f30204f812babfff94dcf77863 to your computer and use it in GitHub Desktop.
from flask import Flask, jsonify
import random
app = Flask(__name__)
FILENAME = 'boh.json'
@app.route("/hello")
def ciao():
dumb_dict = {"hello": "world", "number": 30, "boh": 17.22}
value = random.randint(0, 0xffffffff)
f = open(FILENAME, 'w')
f.write(str(value))
f.close()
return jsonify(dumb_dict)
@app.route("/foo")
def boh():
return "<h1>boh</h1>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment