Skip to content

Instantly share code, notes, and snippets.

@lornajane
Created July 13, 2020 13:22
Show Gist options
  • Save lornajane/e2f0ffd11dd8abb40215cabc691aff55 to your computer and use it in GitHub Desktop.
Save lornajane/e2f0ffd11dd8abb40215cabc691aff55 to your computer and use it in GitHub Desktop.
Very simple Flask webhook receiver
import logging
import pprint
from flask import Flask
from flask import jsonify
from flask import request
from pprint import pformat
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
@app.route('/json')
def serve_json():
response = {
"message": "Hello",
"number": 42
}
return jsonify(response)
@app.route('/webhook', methods=['GET','POST'])
def webhook():
logging.info("Request received")
logging.info(request.args)
logging.info(request.form)
return "OK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment