I am able to successfully connect to an API using Postman. Below is the pre-request script on Postman:
postman.clearGlobalVariable("hmac");
var secretKey = "dummykey"
var sha1 = CryptoJS.HmacSHA1(request.data, secretKey);
var base = CryptoJS.enc.Base64.stringify(sha1);
postman.setGlobalVariable("hmac", base);
I am trying to generate the same hash value as above in python
import base64
import time
import hmac
import hashlib
import binascii
key = "dummykey"
message = '{"ID": "abc123","Name": "dummyname", "TimestampUtc":"2017-10-10T14:03:17.637"}' #some dummy json
digest = hmac.new(key, message, hashlib.sha1).digest()
hash_value = base64.b64encode(digest).decode('utf-8')
print(hash_value)
but I am getting a different hash_value. I am unable to connect to the API in python. How do I make sure to get the same hash value in python?