From d71a2bc0cf6a14523d51828d5d1ad47075bbdb3f Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 1 Apr 2011 12:36:30 +0300 Subject: added s3 stuff --- s3/gen_policy.py | 21 +++++++++++++++++++++ s3/upload.html | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 s3/gen_policy.py create mode 100644 s3/upload.html (limited to 's3') diff --git a/s3/gen_policy.py b/s3/gen_policy.py new file mode 100644 index 0000000..4d0180c --- /dev/null +++ b/s3/gen_policy.py @@ -0,0 +1,21 @@ +import base64 +import hmac, hashlib + +POLICY = """{"expiration": "2012-01-01T00:00:00Z", + "conditions": [ + {"bucket": "AWS_BUCKET_NAME"}, + ["starts-with", "$key", "uploads/"], + {"acl": "private"}, + {"success_action_redirect": "/"}, + ["starts-with", "$Content-Type", ""], + ["content-length-range", 0, 1048576] + ] +}""" + +KEY = "AWS_SECRET_KEY" + +policy = base64.b64encode(POLICY) + +sig = base64.b64encode(hmac.new(KEY, policy, hashlib.sha1).digest()) + +print sig diff --git a/s3/upload.html b/s3/upload.html new file mode 100644 index 0000000..b05a599 --- /dev/null +++ b/s3/upload.html @@ -0,0 +1,19 @@ + + + + S3 POST Upload Form + + +
+
+
+
+ + + + + +
+ + + \ No newline at end of file -- cgit v1.3.1