Download app.py from tonyassi/webhook-receiver-dev: direct link, hf CLI and curl.
- Browser
- Download file 606 Bytes
-
https://huggingface.co/spaces/tonyassi/webhook-receiver-dev/resolve/main/app.py
- Command line
-
hf download hf://spaces/tonyassi/webhook-receiver-dev/app.py
-
curl -L -o app.py https://huggingface.co/spaces/tonyassi/webhook-receiver-dev/resolve/main/app.py
606 Bytes
| from flask import Flask, request, jsonify | |
| import logging | |
| app = Flask(__name__) | |
| def index(): | |
| content =""" | |
| Hello, Webhook Receiver! <br><br> | |
| curl -X POST "https://tonyassi-webhook-receiver-dev.hf.space/json" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"key1": "value1", "key2": "value2"}' | |
| """ | |
| return content | |
| def handle_json(): | |
| data = request.get_json() | |
| print(data) | |
| return jsonify(data), 200 # Return JSON response with HTTP 200 | |
| if __name__ == '__main__': | |
| app.run(host="0.0.0.0", port=7860) | |