def _DownloadObjectToFileNonResumable(src_url, src_obj_metadata, dst_url,
                                      download_file_name, gsutil_api,
                                      digesters, decryption_key=None):
  try:
    fp = open(download_file_name, 'w')

    # This is used to pass the mediaLink and the size into the download so that
    # we can avoid making an extra HTTP call.
    serialization_data = GetDownloadSerializationData(src_obj_metadata)

    progress_callback = FileProgressCallbackHandler(
        ConstructAnnounceText('Downloading', dst_url.url_string),
        gsutil_api.status_queue).call

    if global_copy_helper_opts.test_callback_file:
      with open(global_copy_helper_opts.test_callback_file, 'rb') as test_fp:
        progress_callback = pickle.loads(test_fp.read()).call

    server_encoding = gsutil_api.GetObjectMedia(
        src_url.bucket_name, src_url.object_name, fp,
        generation=src_url.generation, object_size=src_obj_metadata.size,
        download_strategy=CloudApi.DownloadStrategy.ONE_SHOT,
        provider=src_url.scheme, serialization_data=serialization_data,
        digesters=digesters, progress_callback=progress_callback,
        decryption_tuple=CryptoTupleFromKey(decryption_key))
  finally:
    if fp:
      fp.close()

  return src_obj_metadata.size, server_encoding
Downloads an object to a local file using the non-resumable strategy.
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/copy_helper.py/_DownloadObjectToFileNonResumable