Analysis返回格式调整,不具备通用性,需要特殊适配
(self, response)
| 37 | self._server_url = server_url |
| 38 | |
| 39 | def get_data_from_result(self, response): |
| 40 | """ |
| 41 | Analysis返回格式调整,不具备通用性,需要特殊适配 |
| 42 | """ |
| 43 | return_data = response.read() |
| 44 | return_str = return_data.decode("utf8") |
| 45 | # 可能为空字符串,直接返回,不需要转换json |
| 46 | if not return_str: |
| 47 | return return_str |
| 48 | result = json.loads(return_str) |
| 49 | if isinstance(result, dict): |
| 50 | if result.get("data") is not None and result.get("code") is not None \ |
| 51 | and result.get("status_code") is not None: |
| 52 | return result["data"] |
| 53 | return result |
| 54 | |
| 55 | def job_heart_beat(self, org_sid, team_name, repo_id, project_id, job_id): |
| 56 | """任务心跳上报 |
no test coverage detected