~txawsteam/txaws/trunk

« back to all changes in this revision

Viewing changes to txaws/util.py

  • Committer: Duncan McGreggor
  • Date: 2009-08-18 20:29:18 UTC
  • mfrom: (7.1.2 413741-pep8-cleanup)
  • Revision ID: duncan@canonical.com-20090818202918-h6vxh0y42ics0s93
Merged 413741-pep8-cleanup [r=oubiwann,lifeless] [f=413741].

This change brought comments, docstrings, imports, and long lines into a
semblance of consistency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
services.
5
5
"""
6
6
 
7
 
__all__ = ['hmac_sha1', 'iso8601time']
8
 
 
9
7
from base64 import b64encode
10
8
from hashlib import sha1
11
9
import hmac
12
10
import time
 
11
 
13
12
# Import XML from somwhere; here in one place to prevent duplication.
14
13
try:
15
14
    from xml.etree.ElementTree import XML
16
15
except ImportError:
17
16
    from elementtree.ElementTree import XML
18
17
 
 
18
 
 
19
__all__ = ['hmac_sha1', 'iso8601time']
 
20
 
 
21
 
19
22
def hmac_sha1(secret, data):
20
23
    digest = hmac.new(secret, data, sha1).digest()
21
24
    return b64encode(digest)