@@ -1302,6 +1302,7 @@ def _download_file(self, url: str, directory: str = '', overwrite: bool = False)
1302
1302
chunksize = int (self .config .DOWNLOAD_CHUNK_SIZE )
1303
1303
session = self ._session ()
1304
1304
filename = self .get_download_filename_from_url (url )
1305
+ new_url = url
1305
1306
1306
1307
if directory :
1307
1308
filename = os .path .join (directory , filename )
@@ -1317,12 +1318,12 @@ def _download_file(self, url: str, directory: str = '', overwrite: bool = False)
1317
1318
is_opendap = parse_result .netloc .startswith ('opendap' )
1318
1319
method = 'post' if is_opendap else 'get'
1319
1320
if is_opendap : # remove the query params from the URL and convert to dict
1320
- url = parse .urlunparse (parse_result ._replace (query = "" ))
1321
+ new_url = parse .urlunparse (parse_result ._replace (query = "" ))
1321
1322
data_dict = dict (parse .parse_qsl (parse .urlsplit (url ).query ))
1322
1323
headers = {
1323
1324
"Accept-Encoding" : "identity"
1324
1325
}
1325
- with getattr (session , method )(url , data = data_dict , stream = True , headers = headers ) as r :
1326
+ with getattr (session , method )(new_url , data = data_dict , stream = True , headers = headers ) as r :
1326
1327
with open (filename , 'wb' ) as f :
1327
1328
shutil .copyfileobj (r .raw , f , length = chunksize )
1328
1329
if verbose and verbose .upper () == 'TRUE' :
0 commit comments