import hmac import hashlib dig = hmac.new(bytes(secret, 'latin-1'), msg=bytes("timestamp=1591702613943",'latin-1' ) , digestmod=hashlib.sha256).hexdigest()