Created
November 20, 2009 20:30
-
-
Save flukeout/239751 to your computer and use it in GitHub Desktop.
Zeep Mobile - Generating the authentication header - Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Created by Simon Wex ([email protected]) on 2008-07-12 | |
# Copyright (c) 2008. All rights reserved. | |
# Released under MIT License | |
import base64 | |
import hmac | |
import sha | |
import time | |
SECRET_ACCESS_KEY = '19c87eb3e3a28404e7ea8197d4401540' | |
kv = {'API_KEY': 'cef7a046258082993759bade995b3ae8', | |
'Body': 'The brown fox jumped over the lazy dog.', | |
'Version': '2008-07-18', | |
'SignatureVersion': '1', | |
'Timestamp': time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime()) | |
} | |
sig = hmac.new(SECRET_ACCESS_KEY, digestmod=sha) | |
items = kv.items() | |
# Sort the keys | |
items.sort() | |
for key, value in items: | |
sig.update(key) | |
sig.update(value) | |
print base64.encodestring(sig.digest()).strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment