Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68892

Re: TypeError in HMAC module.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'calculating': 0.09; 'skip:k 40': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hashed': 0.16; 'program?': 0.16; 'sure.': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'library,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; '25,': 0.31; 'ball': 0.31; 'thanks!': 0.32; 'says': 0.33; 'call.': 0.33; 'amazon': 0.34; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'url:org': 0.36; 'either': 0.39; 'services,': 0.61; 'complete': 0.62; "you've": 0.63; 'telling': 0.64; 'here': 0.66; 'mar': 0.68; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=JvyJPH/lA80OVVw1CPEKUyPRNnubQI/iR1Sf1rc9Kik=; b=m1cZld8lSdxlV3qd5OLGk/+Ccl9zRwib1swrdRg633g/kdQOI5flWYp5x4EtTsJTuv sTfd6DoBn3GK6vjoq7IYEjss3RFbXwN3QTgs7vAxtjdg030/BP+Q3hnHuriDWBTQacqX bceeqooIQ/4BWhgdKG3Lht5fnQxsKGzvNU/87VMQ5yQ8qW+U5tDwuB5az0RbnMPraSUE qAoH9JcUfpdyCNyMwSSNyfnlnC1SsVXjNEzTpSkJ2W/xD84V2k7/YCxq1g7Y/s0C6MuR OSgORTNcVyRRp/Iu5U5fXnnizjxNgpCdlzvBCLM0qzAxdmHNYBp9ofaNC4FaEPorhLzP O36Q==
MIME-Version 1.0
X-Received by 10.68.197.36 with SMTP id ir4mr72338906pbc.46.1395687955580; Mon, 24 Mar 2014 12:05:55 -0700 (PDT)
In-Reply-To <CADjSiz7y2Zx8RDtE5n8gRMQ=0A3mcB_s548R4FXkBO1cfA-vog@mail.gmail.com>
References <CADjSiz7y2Zx8RDtE5n8gRMQ=0A3mcB_s548R4FXkBO1cfA-vog@mail.gmail.com>
Date Tue, 25 Mar 2014 06:05:55 +1100
Subject Re: TypeError in HMAC module.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8456.1395687963.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395687963 news.xs4all.nl 2894 [2001:888:2000:d::a6]:39935
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68892

Show key headers only | View raw


On Tue, Mar 25, 2014 at 2:15 AM, Prabir Kr Sarkar
<prabir.kr.sarkar@gmail.com> wrote:
> 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]

I can't "import keyring", so either that's a module that isn't in the
Python standard library, or "keyring" is some object you've
instantiated. My crystal ball says this might be something to do with
Amazon Web Services, but it's hard to be sure. Can you please help us
out here by telling us all the dependencies of your code, and also
showing us a complete runnable program?

http://www.sscce.org/

Thanks!

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: TypeError in HMAC module. Chris Angelico <rosuav@gmail.com> - 2014-03-25 06:05 +1100

csiph-web