Created
October 2, 2009 05:09
-
-
Save anonymous/199481 to your computer and use it in GitHub Desktop.
This file contains 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
import time | |
import base64 | |
import hmac | |
from hashlib import sha1 | |
def create_signature(date, method, path): | |
data = "-%s-%s-%s-" % (date, method, path) | |
salt = sha1(data).hexdigest()[:20] | |
return base64.encodestring(hmac.new("ANKODER_PRIVATE_KEY", salt, sha1).digest()).strip() | |
date = time.strftime("%a, %d %b %Y %X GMT", time.gmtime()) | |
date = "Fri, 02 Oct 2009 05:58:43 GMT" | |
sig = create_signature(date, "GET", "/profile") | |
print 'curl api.ankoder.com/profile -X GET -H "ankoder_access_key: ANKODER_ACCESS_KEY" -H "ankoder_passkey: %s" -H "ankoder_date: %s"' % (sig, date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment