Skip to content

Instantly share code, notes, and snippets.

@peterjpxie
Created August 8, 2019 05:33
Show Gist options
  • Save peterjpxie/a94106ac10a94b1905adaef7b0a717b7 to your computer and use it in GitHub Desktop.
Save peterjpxie/a94106ac10a94b1905adaef7b0a717b7 to your computer and use it in GitHub Desktop.
from flask import Flask
import time
app = Flask(__name__)
@app.route('/json', methods=['POST', 'GET'])
def test_json():
time.sleep(0.2) # simulate delay
return '{"code": 1, "message": "Hello, World!" }'
# Run in HTTP
app.run(host='127.0.0.1', port='5000')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment