MCPcopy Create free account
hub / github.com/adobe/Marinus / download_file

Function download_file

python3_cron_scripts/common_crawl_graph.py:75–89  ·  view source on GitHub ↗

Download the file from the provided URL. Use the filename in the URL as the name of the outputed file.

(logger, url, save_location)

Source from the content-addressed store, hash-verified

73
74
75def download_file(logger, url, save_location):
76 """
77 Download the file from the provided URL.
78 Use the filename in the URL as the name of the outputed file.
79 """
80 local_filename = save_location + url.split("/")[-1]
81 logger.debug(local_filename)
82 # NOTE the stream=True parameter
83 req = requests.get(url, stream=True)
84 with open(local_filename, "wb") as out_f:
85 for chunk in req.iter_content(chunk_size=1024):
86 if chunk: # filter out keep-alive new chunks
87 out_f.write(chunk)
88 out_f.close()
89 return local_filename
90
91
92def check_zones(domain, zones):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected