Created
July 13, 2020 13:22
-
-
Save lornajane/e2f0ffd11dd8abb40215cabc691aff55 to your computer and use it in GitHub Desktop.
Very simple Flask webhook receiver
This file contains 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
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