@@ -0,0 +1,1413 @@
+import cStringIO%0Aimport datetime%0Aimport gzip%0A%0Adef compress(s):%0A    zbuf = cStringIO.StringIO()%0A    zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)%0A    zfile.write(s)%0A    zfile.close()%0A    return zbuf.getvalue()%0A%0Aclass S3(object):%0A    %0A    def __init__(key, secret):%0A        self._key = key%0A        self._secret = secret%0A%0A    def upload(path, content, content_type):%0A    %0A        now = datetime.datetime.utcnow()%0A        rfc_now = now.strftime(%22%25a, %25d %25b %25Y %25X GMT%22)%0A        expires = now + datetime.timedelta(1)%0A%0A        content = compress(content)%0A        checksum = base64.b64encode(md5.new(content).digest())%0A%0A        to_sign = %22%5Cn%22.join(%5B%22PUT%22, checksum, content_type, rfc_now, %22x-amz-acl:public-read%22, %22/%25s%25s%22 %25 (AWS_BUCKET, AWS_PATH)%5D)%0A        sig = base64.encodestring(hmac.new(AWS_SECRET, to_sign, sha).digest()).strip()%0A%0A        headers = %7B%0A            %22x-amz-acl%22: %22public-read%22,%0A            %22Expires%22: expires.strftime(%22%25a, %25d %25b %25Y %25H:%25M:%25S UTC%22),%0A            %22Content-Type%22: content_type,%0A            %22Content-Length%22: len(content),%0A            %22Content-MD5%22: checksum,%0A            %22Content-Encoding%22: %22gzip%22,%0A            %22Date%22: rfc_now,%0A            %22Authorization%22: %22AWS %25s:%25s%22 %25 (AWS_KEY, sig)%0A        %7D%0A%0A        s3_conn = httplib.HTTPConnection(AWS_BUCKET)%0A        s3_conn.request(%22PUT%22, AWS_PATH, content, headers)%0A        response = s3_conn.getresponse()%0A        s3_conn.close()

add beginning of s3.py script to remove Amazon's S3.py