def get_remote_file(key_name): key = bucket.get_key(key_name) remote_file = RemoteFile(key) if config.verbose: parallel.t_print(remote_file) else: parallel.t_write(".") return remote_file
def upload_file(local_file): key = bucket.new_key(local_file.name) filename = local_file.path headers = {} if local_file.content_type: headers['Content-Type'] = local_file.content_type if local_file.content_encoding: headers['Content-Encoding'] = local_file.content_encoding if local_file.md5: hex_md5 = local_file.md5 b64_md5 = hex_md5.decode('hex').encode('base64').strip() md5 = (hex_md5, b64_md5) else: md5 = None policy = local_file.policy if verbose: parallel.t_print("Uploading %r %r" % (local_file.name, headers)) key.set_contents_from_filename(filename,headers,md5=md5,policy=policy) if not verbose: parallel.t_write(".") return None
def upload_file(local_file): key = bucket.new_key(local_file.name) filename = local_file.path headers = {} if local_file.content_type: headers['Content-Type'] = local_file.content_type if local_file.content_encoding: headers['Content-Encoding'] = local_file.content_encoding if local_file.md5: hex_md5 = local_file.md5 b64_md5 = hex_md5.decode('hex').encode('base64').strip() md5 = (hex_md5, b64_md5) else: md5 = None policy = local_file.policy if verbose: parallel.t_print("Uploading %r %r" % (local_file.name, headers)) key.set_contents_from_filename(filename, headers, md5=md5, policy=policy) if not verbose: parallel.t_write(".") return None