Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:199481
Created Oct 2, 2009

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("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 -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