Made some changes to templates (oops). But mostly working on Spark help menu/context aware calls that aren't working as expected.

This commit is contained in:
Norm Rasmussen
2025-08-20 15:17:29 -04:00
parent 564362fc50
commit b52e7cfac1
4 changed files with 90 additions and 54 deletions

View File

@ -15,18 +15,21 @@ driver_auth = "https://walmart.northpass.io/driver/authenticate"
stage_url = "https://walmart.np-mt-dev.net/helpMenu"
random_uuid = uuid.uuid4()
msg_body = {
"sessionExpiryTimeInSeconds": 3600,
"messageExpirationTimestamp": 1758722640,
"driver": {
"uuid": str(random_uuid),
"accessLevel": "BEGINNER"
},
"subCategory": "REWARDS",
"appContext": "contextAwareHelp"
}
# msg_body = {
# "sessionExpiryTimeInSeconds": 3600,
# "messageExpirationTimestamp": 1758722640,
# "driver": {
# "uuid": str(random_uuid),
# "accessLevel": "BEGINNER"
# },
# "subCategory": "REWARDS",
# "appContext": "contextAwareHelp"
# }
msg_body = {"sessionExpiryTimeInSeconds":3600,"messageExpirationTimestamp":1758722640,"driver":{"uuid":str(random_uuid),"accessLevel":"BEGINNER"},"subCategory":"REWARDS","appContext":"contextAwareHelp"}
print(msg_body)
msg_body_json = json.dumps(msg_body, sort_keys=True)
print(msg_body_json)
body_signature = hmac.new(secret_key, msg_body_json.encode('utf-8'), hashlib.sha256).hexdigest()
# "accept": "application/json",
@ -40,7 +43,7 @@ header = {
headers = { 'Content-Type': 'application/json','X-Hmac-SHA256': body_signature }
# prod = requests.post(prod_url, headers=headers, json=msg_body)
prod = requests.post(prod_url, headers=headers, json=msg_body)
prod = requests.post(prod_url, headers=headers, json=msg_body_json)
print(f"Status Code: {prod.status_code}")
print(f"Response: {prod.json()}")
print(f"Body Signature: {body_signature}")
@ -65,15 +68,5 @@ Testing the same curl respone for Spark:
curl -X POST --location "https://walmart.northpass.io/helpMenu" \
-H "X-Hmac-SHA256: fec9bb0355b2b599d6cfc22c73b5e8df3159d0b8b275af5229c900e29e3081c8" \
-H "Content-Type: application/json" \
-d '{
"sessionExpiryTimeInSeconds": 3600,
"messageExpirationTimestamp": 1758722640,
"driver": {
"uuid": "3949c78e-9a9c-43d6-92f0-8c474c0e1d1e",
"accessLevel": "BEGINNER"
},
"subCategory": "REWARDS",
"appContext": "contextAwareHelp"
}'
-d '{"sessionExpiryTimeInSeconds":3600,"messageExpirationTimestamp":1758722640,"driver":{"uuid":"3949c78e-9a9c-43d6-92f0-8c474c0e1d1e","accessLevel":"BEGINNER"},"subCategory":"REWARDS","appContext":"contextAwareHelp"}'
"""