Skip to content

Instantly share code, notes, and snippets.

@lornajane
Created Jul 13, 2020
Embed
What would you like to do?
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