Skip to content

Instantly share code, notes, and snippets.

@tomellis
Created May 30, 2013 09:09
Show Gist options
  • Save tomellis/5676663 to your computer and use it in GitHub Desktop.
Save tomellis/5676663 to your computer and use it in GitHub Desktop.
import hmac
from hashlib import sha1
from time import time
path = 'v1/MossoCloudFS_db3a5ebc-f7dd-4108-ab6e-a0bc7b3fbc93/test'
redirect = 'http://mysite.com/thanks.html'
max_file_size = 104857600
max_file_count = 10
expires = int(time() + 600)
print "expires: "
print expires
key = 'mykey'
hmac_body = '%s\n%s\n%s\n%s\n%s' % (path, redirect, max_file_size, max_file_count, expires)
signature = hmac.new(key, hmac_body, sha1).hexdigest()
print "signature: "
print signature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment