Created
December 18, 2015 10:03
-
-
Save thewheat/c6d54779515f7a50399c to your computer and use it in GitHub Desktop.
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
| import hashlib | |
| import hmac | |
| from flask import Flask | |
| from flask import request, url_for | |
| app = Flask(__name__) | |
| @app.route('/', methods=['GET', 'POST']) | |
| def hello_world(): | |
| KEY = "" # REPLACE WITH YOUR HUB SECRET VALUE | |
| SIGNATURE = str(request.headers['X-Hub-Signature']) | |
| MESSAGE = request.get_data() | |
| SIGN = "" | |
| calculated = hmac.new(KEY, MESSAGE, hashlib.sha1).hexdigest() | |
| calculated = "sha1=" + (calculated) | |
| if calculated == SIGNATURE: | |
| print " YES! " | |
| else: | |
| print " No..... =( " | |
| if __name__ == '__main__': | |
| app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment