SatSale

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c1d8f4275f16f73093150b1aa8429e75549b1525
parent a2dedbcb38db86125cf41a8c92b445ce229ebd3f
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date:   Sun, 17 Jan 2021 14:22:13 +1100

Add webhook auth

Diffstat:
Mserver.py | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/server.py b/server.py @@ -2,7 +2,6 @@ from flask import Flask, render_template, session, request from flask_socketio import SocketIO, emit, disconnect from markupsafe import escape import time -import timestamp import os import requests import hmac @@ -81,13 +80,14 @@ def make_payment(payload): update_status(payment) # Call webhook - if 'w_url' is in payload.keys(): + if 'w_url' in payload.keys(): params = {'id' : payload['id'], 'time' : time.time()} - message = timestamp.encode('utf-8') + b'.' + body + message = time.time().encode('utf-8') + b'.' + body hash = hmac.new(app.config['SECRET_KEY'], message, hashlib.sha256) headers={'Content-Type': 'application/json', 'X-Signature' : hash} print(params, headers) + response = requests.get( payload['w_url'], params=params, headers=headers)