|
|
@@ -5,6 +5,10 @@ import requests
|
|
|
from urllib.request import urlretrieve
|
|
|
import os
|
|
|
import argparse
|
|
|
+import json
|
|
|
+
|
|
|
+g_config = None
|
|
|
+config_path = 'config.json'
|
|
|
|
|
|
def reporthook(count, block_size, total_size):
|
|
|
"""
|
|
|
@@ -48,6 +52,13 @@ if __name__ == "__main__":
|
|
|
if args.p:
|
|
|
proxy = str(args.p)
|
|
|
|
|
|
+ g_config = {}
|
|
|
+ if os.path.exists(config_path):
|
|
|
+ with open(config_path) as file:
|
|
|
+ g_config = json.load(file)
|
|
|
+ if 'proxy' in g_config and not args.p: # args.p优先
|
|
|
+ proxy = g_config['proxy']
|
|
|
+
|
|
|
http_down(project, down_list, proxy)
|
|
|
|
|
|
|