Skip to content

Instantly share code, notes, and snippets.

@vinodc
Last active July 28, 2021 08:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinodc/ee4933114e988bc02995 to your computer and use it in GitHub Desktop.
Save vinodc/ee4933114e988bc02995 to your computer and use it in GitHub Desktop.
Simple Kloudless API webhooks receiver for testing purposes
#!/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