【发布时间】:2020-09-24 07:38:07
【问题描述】:
我正在尝试调用基于GET 请求的HTTP 触发的Azure function。我按照推荐的步骤设置了链接服务,并且函数本身通过 POSTMAN 或 Internet 浏览器使用查询字符串,但是当我尝试通过数据工厂调用时失败。
{
"errorCode": "3608",
"message": "Call to provided Azure function '' failed with status-'NotFound' and message - 'Invoking Azure function failed with HttpStatusCode - NotFound.'.",
"failureType": "UserError",
"target": "Azure Function1",
"details": []
}
我遇到了另一个 stackoverflow 帖子 https://stackoverflow.com/a/54497119/4212430,其中提到了对 ADF 的 JSON 响应。
我已经更改了我的 python 代码以提供一个HTTP 响应作为JSON 对象,如下所示
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
statename = req.params.get('statename')
if not statename:
try:
req_body = req.get_json()
except ValueError:
pass
else:
statename = req_body.get('statename')
if statename:
initiate_main(statename)
host.close()
function_message = {"Response":"Successfully trasnferred BOM files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=200)
else:
function_message = {"Response":"Error in transferring files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=400)
但这也无济于事。
【问题讨论】:
标签: json python-3.x azure azure-functions azure-data-factory-2