#NEWLINE# def set_contents_from_stream( self , fp , headers = None , replace = True , cb = None , num_cb = 10 , policy = None , reduced_redundancy = False , query_args = None , size = None ) : #NEWLINE# #INDENT# "\n        Store an object using the name of the Key object as the key in\n        cloud and the contents of the data stream pointed to by 'fp' as\n        the contents.\n        The stream object is not seekable and total size is not known.\n        This has the implication that we can't specify the Content-Size and\n        Content-MD5 in the header. So for huge uploads, the delay in calculating\n        MD5 is avoided but with a penalty of inability to verify the integrity\n        of the uploaded data.\n\n        :type fp: file\n        :param fp: the file whose contents are to be uploaded\n\n        :type headers: dict\n        :param headers: additional HTTP headers to be sent with the PUT request.\n\n        :type replace: bool\n        :param replace: If this parameter is False, the method will first check\n            to see if an object exists in the bucket with the same key. If it\n            does, it won't overwrite it. The default value is True which will\n            overwrite the object.\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 two integer\n            parameters, the first representing the number of bytes that have\n            been successfully transmitted to GS and the second representing the\n            total number of bytes that need to be transmitted.\n\n        :type num_cb: int\n        :param num_cb: (optional) If a callback is specified with the cb\n            parameter, this parameter determines the granularity of the callback\n            by defining the maximum number of times the callback will be called\n            during the file transfer.\n\n        :type policy: :class:`boto.gs.acl.CannedACLStrings`\n        :param policy: A canned ACL policy that will be applied to the new key\n            in GS.\n\n        :type reduced_redundancy: bool\n        :param reduced_redundancy: If True, this will set the storage\n                                   class of the new Key to be\n                                   REDUCED_REDUNDANCY. The Reduced Redundancy\n                                   Storage (RRS) feature of S3, provides lower\n                                   redundancy at lower storage cost.\n        :type size: int\n        :param size: (optional) The Maximum number of bytes to read from\n                      the file pointer (fp). This is useful when uploading\n                      a file in multiple parts where you are splitting the\n                      file up into different ranges to be uploaded. If not\n                      specified, the default behaviour is to read all bytes\n                      from the file pointer. Less bytes may be available.\n        " #NEWLINE# provider = self . bucket . connection . provider #NEWLINE# if ( not provider . supports_chunked_transfer ( ) ) : #NEWLINE# #INDENT# raise BotoClientError ( ( '%s does not support chunked transfer' % provider . get_provider_name ( ) ) ) #NEWLINE# #UNINDENT# if ( ( not self . name ) or ( self . name == '' ) ) : #NEWLINE# #INDENT# raise BotoClientError ( 'Cannot determine the destination object name for the given stream' ) #NEWLINE# #UNINDENT# if ( headers is None ) : #NEWLINE# #INDENT# headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if reduced_redundancy : #NEWLINE# #INDENT# headers [ provider . acl_header ] = policy #NEWLINE# #UNINDENT# if reduced_redundancy : #NEWLINE# #INDENT# self . storage_class = 'REDUCED_REDUNDANCY' #NEWLINE# if provider . storage_class_header : #NEWLINE# #INDENT# headers [ provider . storage_class_header ] = self . storage_class #NEWLINE# #UNINDENT# #UNINDENT# if ( self . bucket != None ) : #NEWLINE# #INDENT# if ( not replace ) : #NEWLINE# #INDENT# if self . bucket . lookup ( self . name ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# self . send_file ( fp , headers , cb , num_cb , query_args , chunked_transfer = True , size = size )