(url, output_dir)
| 64 | |
| 65 | |
| 66 | def download_file(url, output_dir): |
| 67 | # Create output_dir if not exists. |
| 68 | if not os.path.exists(output_dir): |
| 69 | os.makedirs(output_dir) |
| 70 | |
| 71 | file_name = url.split('/')[-1] |
| 72 | file_path = os.path.join(output_dir, file_name) |
| 73 | |
| 74 | response = requests.get(url, stream=True) |
| 75 | with open(file_path, 'wb') as f: |
| 76 | shutil.copyfileobj(response.raw, f) |
| 77 | |
| 78 | return file_path |
| 79 | |
| 80 | |
| 81 | def get_replay_pack(client_version, client_key, client_secret, replays_dir, extract=False): |