<div dir="ltr"><div>Hi,</div><div>   I am trying to create a hashed message for authentication for a REST API call. I have got the key from a keyring as :-</div><div><br></div><div>key = keyring.get_password('AWS_keyring','username')<br>
</div><div><br></div><div>& calculating the signature as :-</div><div>signature = hmac(key, message.encode('UTF-8'), hashlib.sha1).digest().encode('base64')[:-1]<br></div>
<div><br></div><div>But, while running the script I get the following errors :-</div><div><br></div><div>  File "/usr/lib64/python2.6/hmac.py", line 133, in new</div><div>    return HMAC(key, msg, digestmod)</div>
<div>  File "/usr/lib64/python2.6/hmac.py", line 72, in __init__</div><div><b>    self.outer.update(key.translate(trans_5C))</b></div>
<div><b>TypeError: character mapping must return integer, None or unicode</b></div><div><br></div><div>My python version is :-</div><div><br></div><div><div># python -V</div><div>Python 2.6.9</div></div><div><br></div><div>
Can someone please help me as to how I can resolve this issue. Thanks in advance.</div><div><br></div>-- <br><div dir="ltr"><div><b>Thanks and Regards</b></div><div><b>Prabir Sarkar</b></div><div><br></div></div>
</div>