This commit is contained in:
the 2024-11-13 00:53:31 +04:00
parent b009ebdd0c
commit 83aec339c9

View File

@ -113,8 +113,10 @@ class Manager:
@app.route(f'/webhook', methods=['POST']) @app.route(f'/webhook', methods=['POST'])
def webhook(): def webhook():
print("received webhook", request.args.get('id'))
for manager in managers: for manager in managers:
if request.args.get('id') == manager._id and request.method == 'POST': print()
if int(request.args.get('id')) == manager._id and request.method == 'POST':
print("Data received from Webhook is", request.json) print("Data received from Webhook is", request.json)
body = request.json body = request.json
@ -126,10 +128,9 @@ def webhook():
return f"Webhook received for manager {manager._id}" return f"Webhook received for manager {manager._id}"
return "Webhook ignored" return "Webhook ignored"
t1 = threading.Thread(target=start_manager)
manager1 = Manager(_id=1) manager1 = Manager(_id=1)
managers = [manager1] managers = [manager1]
t1 = threading.Thread(target=start_manager)
if __name__ == "__main__": if __name__ == "__main__":
app.run(host="0.0.0.0", port=20002) threading.Thread(target=lambda: app.run(host="0.0.0.0", port=20002, debug=True, use_reloader=False)).start()