Download the file from the provided URL and put it in data_dir
(s, url, data_dir)
| 53 | |
| 54 | |
| 55 | def download_file(s, url, data_dir): |
| 56 | """ |
| 57 | Download the file from the provided URL and put it in data_dir |
| 58 | """ |
| 59 | local_filename = data_dir + url.split("/")[-1] |
| 60 | # NOTE the stream=True parameter |
| 61 | req = s.get(url, stream=True) |
| 62 | with open(local_filename, "wb") as out_f: |
| 63 | for chunk in req.iter_content(chunk_size=128 * 1024): |
| 64 | if chunk: # filter out keep-alive new chunks |
| 65 | out_f.write(chunk) |
| 66 | return local_filename |
| 67 | |
| 68 | |
| 69 | def find_zone(domain, zones): |
no outgoing calls
no test coverage detected