Untitled
unknown
plain_text
2 years ago
944 B
7
Indexable
import requests
import json
import hmac
import hashlib
url = "http://localhost:5000/webhook"
secret_key = b"woltpeopleareretarded"
def calculate_hmac(data):
return hmac.new(secret_key, data.encode("utf-8"), hashlib.sha256).hexdigest()
json_data = {
"id": "90f5c25cbbfb3d131a46e643",
"type": "order.notification",
"order": {
"id": "90f5be47fc97e11107f8a480",
"venue_id": "9a5c7e3102fe6a000c4b562b",
"status": "CREATED",
"resource_url": "https://pos-integration-service.wolt.com/orders/90f5be47fc97e11107f8a480",
},
"created_at": "2021-07-19T18:20:12.378509Z",
}
headers = {
"Content-Type": "application/json",
"Authentication": calculate_hmac(json.dumps(json_data)),
}
response = requests.post(url, json=json_data, headers=headers)
if response.status_code == 200:
print("Server response:", response.json())
else:
print("Error:", response.status_code, response.text)Editor is loading...
Leave a Comment