|
@@ -1,12 +1,13 @@
|
|
|
#!/usr/bin/env python
|
|
#!/usr/bin/env python
|
|
|
# -*- coding: utf-8 -*-
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
-import requests
|
|
|
|
|
|
|
+import requests
|
|
|
from urllib.request import urlretrieve
|
|
from urllib.request import urlretrieve
|
|
|
import os,sys
|
|
import os,sys
|
|
|
-import argparse
|
|
|
|
|
|
|
+from argparse import ArgumentParser
|
|
|
import json
|
|
import json
|
|
|
|
|
|
|
|
|
|
+
|
|
|
g_config = None
|
|
g_config = None
|
|
|
config_path = os.path.dirname(os.path.realpath(sys.argv[0]))+'\config.json'
|
|
config_path = os.path.dirname(os.path.realpath(sys.argv[0]))+'\config.json'
|
|
|
|
|
|
|
@@ -23,6 +24,7 @@ def http_down(project, down_list=[], proxy=""):
|
|
|
git_releases="{}/releases/download/".format(project)
|
|
git_releases="{}/releases/download/".format(project)
|
|
|
|
|
|
|
|
print("获取", git_api)
|
|
print("获取", git_api)
|
|
|
|
|
+ requests.packages.urllib3.disable_warnings()
|
|
|
r = requests.get(git_api, verify=False) #不检查证书
|
|
r = requests.get(git_api, verify=False) #不检查证书
|
|
|
# print(soup)
|
|
# print(soup)
|
|
|
latest_version = r.json()["tag_name"]
|
|
latest_version = r.json()["tag_name"]
|
|
@@ -37,11 +39,12 @@ def http_down(project, down_list=[], proxy=""):
|
|
|
i = str(i).replace("[version]", version_str)
|
|
i = str(i).replace("[version]", version_str)
|
|
|
print('下载 {}...'.format(i))
|
|
print('下载 {}...'.format(i))
|
|
|
urlretrieve(git_down_url+i, latest_version+"/"+i, reporthook)
|
|
urlretrieve(git_down_url+i, latest_version+"/"+i, reporthook)
|
|
|
- print("\n下载完成")
|
|
|
|
|
|
|
+ print("\r")
|
|
|
|
|
+ print("下载完成")
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
print(config_path)
|
|
print(config_path)
|
|
|
- parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
+ parser = ArgumentParser()
|
|
|
parser.add_argument("n", help="项目,譬如 yisier/nps")
|
|
parser.add_argument("n", help="项目,譬如 yisier/nps")
|
|
|
parser.add_argument("l", help="下载列表,譬如 windows_amd64_client.tar.gz,windows_amd64_server.tar.gz, [version]可代替版本")
|
|
parser.add_argument("l", help="下载列表,譬如 windows_amd64_client.tar.gz,windows_amd64_server.tar.gz, [version]可代替版本")
|
|
|
parser.add_argument("-p", default=False, help="代理,譬如 https://ghproxy.com/https://github.com/")
|
|
parser.add_argument("-p", default=False, help="代理,譬如 https://ghproxy.com/https://github.com/")
|