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