public
anonymous / gist:199481
Last active

  • Download Gist
gistfile1.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.