Skip to content

Commit

Permalink
Merge pull request #666 from bensonhome/main
Browse files Browse the repository at this point in the history
🎨优化api请求和进度上报
  • Loading branch information
cyw3 authored Oct 25, 2022
2 parents 7a83c23 + e374908 commit 1a67869
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ USERNAME=
PASSWORD=

[LICENSE_CONFIG]
; [可选]使用自研工具时,需要填写,默认不需要
; [可选]使用自研工具时,需要填写,默认不需要(优先企业或高校申请License)
; license服务器url, base_path, license
URL=
BASE_PATH=
Expand Down
Binary file modified client/task/authcheck/check_license.cp37-win_amd64.pyd
Binary file not shown.
Binary file not shown.
Binary file modified client/task/authcheck/check_license.cpython-37m-darwin.so
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion client/util/api/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
""" http client
"""

import ssl
import json
import logging

Expand Down Expand Up @@ -40,7 +41,7 @@ def request(url, headers, param=None, body=None, method="POST"):
try:
request = Request(url=url, data=body, headers=headers)
request.get_method = lambda: method.upper()
response = urlopen(request)
response = urlopen(request, context=ssl._create_unverified_context())
return response
except HTTPError as err:
error_msg = err.read().decode('utf-8')
Expand Down
5 changes: 3 additions & 2 deletions client/util/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def update_task_progress(self, info):
token = Crypto(settings.PASSWORD_KEY).decrypt(encrypted_token)

dog_server = RetryDogServer(server_url, token).get_api_server(retry_times=0)
# 非节点模式,不存在NODE_ID字段,此时传参为None
# 非节点模式,NODE_ID字段传参为None
node_id = persist_data.get('NODE_ID') if self._task_scene == TaskScene.NORMAL else None
dog_server.update_task_progress(self._task_params,
persist_data.get('NODE_ID'),
node_id,
info.message,
info.percent)
except Exception as err:
Expand Down

0 comments on commit 1a67869

Please sign in to comment.