Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68882 > unrolled thread
| Started by | Prabir Kr Sarkar <prabir.kr.sarkar@gmail.com> |
|---|---|
| First post | 2014-03-24 20:45 +0530 |
| Last post | 2014-03-24 20:45 +0530 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
TypeError in HMAC module. Prabir Kr Sarkar <prabir.kr.sarkar@gmail.com> - 2014-03-24 20:45 +0530
| From | Prabir Kr Sarkar <prabir.kr.sarkar@gmail.com> |
|---|---|
| Date | 2014-03-24 20:45 +0530 |
| Subject | TypeError in HMAC module. |
| Message-ID | <mailman.8450.1395674136.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Hi,
I am trying to create a hashed message for authentication for a REST API
call. I have got the key from a keyring as :-
key = keyring.get_password('AWS_keyring','username')
& calculating the signature as :-
signature = hmac(key, message.encode('UTF-8'),
hashlib.sha1).digest().encode('base64')[:-1]
But, while running the script I get the following errors :-
File "/usr/lib64/python2.6/hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "/usr/lib64/python2.6/hmac.py", line 72, in __init__
* self.outer.update(key.translate(trans_5C))*
*TypeError: character mapping must return integer, None or unicode*
My python version is :-
# python -V
Python 2.6.9
Can someone please help me as to how I can resolve this issue. Thanks in
advance.
--
*Thanks and Regards*
*Prabir Sarkar*
Back to top | Article view | comp.lang.python
csiph-web