合并程序
This commit is contained in:
1 parent
cc15c76e62
commit
968189dee9
22 files changed
+518
-480
No files matched your search
@@ -0,0 +1,2 @@
|
||||
# utils package
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import requests
|
||||
from .logs import log
|
||||
|
||||
url = 'https://mp.api.suwa3d.com'
|
||||
|
||||
def requestApiToUpdateSliceStatusComplate(versionId, downloadCounts):
|
||||
api_url = f"{url}/api/printTypeSettingOrder/updateBatchSliceing?batch_id={versionId}&is_slice_complete=1&download_counts=" + str(downloadCounts)
|
||||
log(f'发起状态变更请求url={api_url}, versionId={versionId}')
|
||||
try:
|
||||
# 添加超时参数,防止请求时间过长
|
||||
res = requests.post(api_url, timeout=60) # 60秒超时
|
||||
if res.status_code != 200:
|
||||
log(f'状态变更请求失败, res={res.text}')
|
||||
return False
|
||||
log(f'状态变更请求成功, res={res.text}')
|
||||
#判断返回的code是否是1000
|
||||
if res.json()["code"] != 1000:
|
||||
log(f'状态变更请求失败, res={res.text}')
|
||||
return False
|
||||
log(f'状态变更请求成功, res={res.text}')
|
||||
return True
|
||||
except requests.exceptions.Timeout:
|
||||
log(f'状态变更请求超时, url={api_url}')
|
||||
return False
|
||||
except requests.exceptions.RequestException as e:
|
||||
log(f'状态变更请求异常, error={str(e)}')
|
||||
return False
|
||||
@@ -66,4 +66,4 @@ def zip_file(folderPath, outputZipPath=None):
|
||||
# zip_file(folderPath)
|
||||
|
||||
|
||||
zip_file("/Users/dcx/code/make2/script/batchPrint/1","1024.zip")
|
||||
# zip_file("/Users/dcx/code/make2/script/batchPrint/1","1024.zip")
|
||||
Reference in new issue
Block a user