@@ -905,7 +905,7 @@ def __init__(self, ak='', sk='', endpoint='', region='',
905905 enable_crc = True ,
906906 connection_time = 10 ,
907907 enable_verify_ssl = True ,
908- dns_cache_time = 0 ,
908+ dns_cache_time = 15 ,
909909 proxy_host : str = None ,
910910 proxy_port : int = None ,
911911 proxy_username : str = None ,
@@ -936,7 +936,7 @@ def __init__(self, ak='', sk='', endpoint='', region='',
936936 :param max_connections: 连接池中允许打开的最大 HTTP 连接数,默认 1024
937937 :param enable_crc: 是否开启上传后客户端 CRC 校验,默认为 true
938938 :param enable_verify_ssl: 是否开启 SSL 证书校验,默认为 true
939- :param dns_cache_time: DNS 缓存的有效期,单位:分钟,小于等于 0 时代表关闭 DNS 缓存,默认为 0
939+ :param dns_cache_time: DNS 缓存的有效期,单位:分钟,小于等于 0 时代表关闭 DNS 缓存,默认为 15
940940 :param proxy_host: 代理服务器的主机地址,当前只支持 http 协议
941941 :param proxy_port: 代理服务器的端口
942942 :param proxy_username: 连接代理服务器时使用的用户名
@@ -2238,10 +2238,13 @@ def get_object_to_file(self, bucket: str, key: str, file_path: str,
22382238 if os .path .isdir (file_path ):
22392239 file_path = os .path .join (file_path , key )
22402240 try_make_file_dir (file_path )
2241+ tmp_file_path = file_path + ".temp." + str (uuid .uuid4 ())
22412242
2242- with open (file_path , 'wb' ) as f :
2243+ with open (tmp_file_path , 'wb' ) as f :
22432244 shutil .copyfileobj (result , f )
22442245
2246+ os .rename (tmp_file_path , file_path )
2247+
22452248 return result
22462249
22472250 def create_multipart_upload (self , bucket : str , key : str ,
0 commit comments