def putObject(self, bucket, key, data, content_type="text/html", 
                  public=True, headers=None, gzip=False):
        bucket = convertToUTF8(bucket)
        key = convertToUTF8(key)
        if not isinstance(data, str):
            data = convertToUTF8(data)
        if headers is None:
            headers = {}
        # Wrap user-defined headers in with the Amazon custom header prefix.
        headers = self._encodeAmazonHeaders(headers)
        if gzip:
            # Gzip that bastard!
            headers["content-encoding"] = "gzip"
            zbuf = cStringIO.StringIO()
            zfile = gzip_package.GzipFile(None, 'wb', 9, zbuf)
            zfile.write(data)
            zfile.close()
            data = zbuf.getvalue()
        content_md5 = base64.encodestring(hashlib.md5(data).digest()).strip()
        if public:
            headers['x-amz-acl'] = 'public-read'
        else:
            headers['x-amz-acl'] = 'private'
        headers.update({
            'Content-Length':len(data),
            'Content-Type':content_type,
            'Content-MD5':content_md5
        })
        path = "/" + bucket + "/" + key
        auth = self._getAuthorization("PUT", content_md5, content_type, 
                                      headers, path)
        headers.update(auth)
        url = "http://%s/%s/%s" % (self.host, bucket, key)
        d = self.rq.getPage(url, method="PUT", headers=headers, postdata=data)
        d.addErrback(self._genericErrback, url, method="PUT", headers=headers, 
                     postdata=data)
        return d
Add an object to a bucket.
dataset/ETHPy150Open wehriam/awspider/awspider/aws/s3.py/AmazonS3.putObject