Skip to content

Commit 1a67869

Browse files
authored
Merge pull request #666 from bensonhome/main
🎨优化api请求和进度上报
2 parents 7a83c23 + e374908 commit 1a67869

7 files changed

Lines changed: 6 additions & 4 deletions

client/config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ USERNAME=
3131
PASSWORD=
3232

3333
[LICENSE_CONFIG]
34-
; [可选]使用自研工具时,需要填写,默认不需要
34+
; [可选]使用自研工具时,需要填写,默认不需要(优先企业或高校申请License)
3535
; license服务器url, base_path, license
3636
URL=
3737
BASE_PATH=
0 Bytes
Binary file not shown.
Binary file not shown.
-256 KB
Binary file not shown.
Binary file not shown.

client/util/api/httpclient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
""" http client
99
"""
1010

11+
import ssl
1112
import json
1213
import logging
1314

@@ -40,7 +41,7 @@ def request(url, headers, param=None, body=None, method="POST"):
4041
try:
4142
request = Request(url=url, data=body, headers=headers)
4243
request.get_method = lambda: method.upper()
43-
response = urlopen(request)
44+
response = urlopen(request, context=ssl._create_unverified_context())
4445
return response
4546
except HTTPError as err:
4647
error_msg = err.read().decode('utf-8')

client/util/reporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ def update_task_progress(self, info):
9191
token = Crypto(settings.PASSWORD_KEY).decrypt(encrypted_token)
9292

9393
dog_server = RetryDogServer(server_url, token).get_api_server(retry_times=0)
94-
# 非节点模式,不存在NODE_ID字段,此时传参为None
94+
# 非节点模式,NODE_ID字段传参为None
95+
node_id = persist_data.get('NODE_ID') if self._task_scene == TaskScene.NORMAL else None
9596
dog_server.update_task_progress(self._task_params,
96-
persist_data.get('NODE_ID'),
97+
node_id,
9798
info.message,
9899
info.percent)
99100
except Exception as err:

0 commit comments

Comments
 (0)