Last active
July 28, 2021 08:05
-
-
Save vinodc/ee4933114e988bc02995 to your computer and use it in GitHub Desktop.
Simple Kloudless API webhooks receiver for testing purposes
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
This is a simple webhooks receiver for testing purposes. It should NOT be used on | |
production as it does not verify the sender. For an example that does, check out | |
http://blog.kloudless.com/2014/10/19/getting-started-with-kloudless-webhooks/ | |
To install dependencies and run: | |
$ pip install flask | |
$ APP_ID=123ABC python kloudless_webhooks.py | |
* Running on http://127.0.0.1:5000/ | |
where 123ABC should be replaced with your Kloudless App ID. | |
You can proxy requests from Kloudless to this local server by using http://ngrok.io. | |
Install it and then run `./ngrok http 5000` to send requests to this Flask server. | |
""" | |
import os | |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route("/", methods=["GET", "POST"]) | |
def app_id(): | |
if request.data: | |
print "Incoming notification: %s" % request.data | |
return os.environ["APP_ID"] | |
if __name__ == "__main__": | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment