diff --git a/flask_webhook/server.py b/flask_webhook/server.py new file mode 100644 index 0000000..3b81f99 --- /dev/null +++ b/flask_webhook/server.py @@ -0,0 +1,15 @@ +from flask import Flask, request, abort + +app = Flask(__name__) + + +@app.route('/webhook', methods=['POST']) +def webhook(): + if request.method == 'POST': + print(request.json) + return 'success', 200 + else: + abort(400) + +if __name__ == '__main__': + app.run() diff --git a/flask_webhook/webhook.py b/flask_webhook/webhook.py new file mode 100644 index 0000000..6bc097d --- /dev/null +++ b/flask_webhook/webhook.py @@ -0,0 +1,10 @@ +import requests +import json + +webhook_url = 'http://127.0.0.1:5000/webhook' + +data = { 'name': 'Request three', + 'Channel URL': 'test url3' } + +r = requests.post(webhook_url, data=json.dumps(data), headers={'Content-Type': 'application/json'}) +