

def set_contents_from_string(self, s, headers=None, replace=True, cb=None, num_cb=10, policy=None, md5=None):
    "\n        Store an object in S3 using the name of the Key object as the\n        key in S3 and the string 's' as the contents.\n        See set_contents_from_file method for details about the\n        parameters.\n\n        :type headers: dict\n        :param headers: Additional headers to pass along with the\n                        request to AWS.\n\n        :type replace: bool\n        :param replace: If True, replaces the contents of the file if\n                        it already exists.\n\n        :type cb: function\n        :param cb: a callback function that will be called to report\n                   progress on the upload.  The callback should accept\n                   two integer parameters, the first representing the\n                   number of bytes that have been successfully\n                   transmitted to S3 and the second representing the\n                   size of the to be transmitted object.\n\n        :type cb: int\n        :param num_cb: (optional) If a callback is specified with\n                       the cb parameter this parameter determines the\n                       granularity of the callback by defining\n                       the maximum number of times the callback will\n                       be called during the file transfer.\n\n        :type policy: :class:`boto.s3.acl.CannedACLStrings`\n        :param policy: A canned ACL policy that will be applied to the\n                       new key in S3.\n\n        :type md5: A tuple containing the hexdigest version of the MD5\n                   checksum of the file as the first element and the\n                   Base64-encoded version of the plain checksum as the\n                   second element.  This is the same format returned by\n                   the compute_md5 method.\n        :param md5: If you need to compute the MD5 for any reason prior\n                    to upload, it's silly to have to do it twice so this\n                    param, if present, will be used as the MD5 values\n                    of the file.  Otherwise, the checksum will be computed.\n        "
    if isinstance(s, unicode):
        s = s.encode('utf-8')
    fp = StringIO.StringIO(s)
    r = self.set_contents_from_file(fp, headers, replace, cb, num_cb, policy, md5)
    fp.close()
    return r

dataset/ETHPy150Open yyuu/botornado/boto/gs/key.py Key.set_contents_from_string/original