flask_webhook #2

Open
cisosama wants to merge 2 commits from flask_webhook into main
2 changed files with 25 additions and 0 deletions
Showing only changes of commit 79a439d8ed - Show all commits

15
flask_webhook/server.py Normal file
View File

@ -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()

10
flask_webhook/webhook.py Normal file
View File

@ -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'})