MCPcopy
hub / github.com/mvdctop/Movie_Data_Capture / download_one_file

Function download_one_file

ADC_function.py:486–500  ·  view source on GitHub ↗

download file save to given path from given url wrapped for map function

(args)

Source from the content-addressed store, hash-verified

484
485
486def download_one_file(args) -> str:
487 """
488 download file save to given path from given url
489 wrapped for map function
490 """
491
492 (url, save_path, json_headers) = args
493 if json_headers is not None:
494 filebytes = get_html(url, return_type='content', json_headers=json_headers['headers'])
495 else:
496 filebytes = get_html(url, return_type='content')
497 if isinstance(filebytes, bytes) and len(filebytes):
498 with save_path.open('wb') as fpbyte:
499 if len(filebytes) == fpbyte.write(filebytes):
500 return str(save_path)
501
502
503def parallel_download_files(dn_list: typing.Iterable[typing.Sequence], parallel: int = 0, json_headers=None):

Callers

nothing calls this directly

Calls 2

get_htmlFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected