更新时间:2022-09-09 GMT+08:00
定时调用
- 定时预测
从console界面上获取到deploy_apipath,body体请求示例如下:
data_dict = { "pred_hour":18, "input_path":"obs://obs_path/test_xxx.csv", # 自定义,指定到csv "output_path":"obs://obs_path/pred_result.json",# 自定义,输出格式为json "S3_ACCESS_KEY_ID":"xxx",# ak "S3_SECRET_ACCESS_KEY":"xxx",# sk "S3_ENDPOINT":"obs.{region_name}.myhuaweicloud.com" # 对应region的endpoint } def infer(header_config, deploy_apipath, data_dict): body = json.dumps(data_dict) response = requests.post(deploy_apipath, headers=header_config, data=body, verify=False) print(response.text.replace("'", '"').replace('/ ', '/')) rep_json = response.json() return rep_json infer(header_config, deploy_apipath, data_dict)
父主题: 实施步骤