Skip to content

Instantly share code, notes, and snippets.

@thewheat
Created December 18, 2015 10:03
Show Gist options
  • Select an option

  • Save thewheat/c6d54779515f7a50399c to your computer and use it in GitHub Desktop.

Select an option

Save thewheat/c6d54779515f7a50399c to your computer and use it in GitHub Desktop.
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