Commit 049d728b by sikang

update script local_privacy

parent 28f4adf3
# -*-coding:utf-8-*-
import sys
import requests
import io
import os
import chardet
privacy_url=sys.argv[1]
#是否更新本地文件
path = "../../../app/src/main/assets/web/".replace("/",os.path.sep)
if not os.path.exists(path):
os.makedirs(path)
resp = requests.get(privacy_url);
content = resp.text
encode = chardet.detect(resp.content)['encoding']
with io.open(path+"privacy.html", "w+", encoding=encode) as fout:
fout.write(content)
print("本地协议已更新!" + privacy_url)
ksp_url=privacy_url.replace(".html","Ksp.html")
resp = requests.get(ksp_url)
content = resp.text
encode = chardet.detect(resp.content)['encoding']
if "<Code>NoSuchKey</Code>" not in content:
with io.open(path+"privacyKsp.html", "w+", encode) as fout:
fout.write(content)
print("本地KSP协议已更新!" + ksp_url)
...@@ -5,6 +5,7 @@ import requests ...@@ -5,6 +5,7 @@ import requests
import io import io
import os import os
import json import json
import chardet
crop_id = sys.argv[1] crop_id = sys.argv[1]
app_name = sys.argv[2] app_name = sys.argv[2]
...@@ -28,14 +29,18 @@ path = "../../../app/src/main/assets/web/".replace("/",os.path.sep) ...@@ -28,14 +29,18 @@ path = "../../../app/src/main/assets/web/".replace("/",os.path.sep)
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
if success and update_local == "true": if success and update_local == "true":
content = requests.get(privacy_url).text resp = requests.get(privacy_url);
with io.open(path+"privacy.html", "w+", encoding="ISO-8859-1") as fout: content = resp.text
encode = chardet.detect(resp.content)['encoding']
with io.open(path+"privacy.html", "w+", encoding=encode) as fout:
fout.write(content) fout.write(content)
print("本地协议已更新!" + privacy_url) print("本地协议已更新!" + privacy_url)
ksp_url=privacy_url.replace(".html","Ksp.html") ksp_url=privacy_url.replace(".html","Ksp.html")
content = requests.get(ksp_url).text resp = requests.get(ksp_url)
content = resp.text
encode = chardet.detect(resp.content)['encoding']
if "<Code>NoSuchKey</Code>" not in content: if "<Code>NoSuchKey</Code>" not in content:
with io.open(path+"privacyKsp.html", "w+", encoding="UTF-8") as fout: with io.open(path+"privacyKsp.html", "w+", encoding=encode) as fout:
fout.write(content) fout.write(content)
print("本地KSP协议已更新!" + ksp_url) print("本地KSP协议已更新!" + ksp_url)
...@@ -29,6 +29,7 @@ echo "24、添加toolbox库" ...@@ -29,6 +29,7 @@ echo "24、添加toolbox库"
echo "25、马甲包切换" echo "25、马甲包切换"
echo "26、打印checklist" echo "26、打印checklist"
echo "27、更换隐私协议" echo "27、更换隐私协议"
echo "28、刷新本地协议"
echo " " echo " "
if [[ "$app_name" == "$majia_name" ]];then if [[ "$app_name" == "$majia_name" ]];then
...@@ -289,6 +290,11 @@ elif (($commod == '27'));then ...@@ -289,6 +290,11 @@ elif (($commod == '27'));then
cd privacy cd privacy
python update_privacy.py "${corp_id}" "${app_name}" "${agreement_url}" "true" python update_privacy.py "${corp_id}" "${app_name}" "${agreement_url}" "true"
elif (($commod == '28'));then
cd privacy
python update_local.py "${agreement_url}"
elif (($commod == '10000')) elif (($commod == '10000'))
then then
cd .. cd ..
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment