【发布时间】:2020-01-30 09:45:22
【问题描述】:
我有新函数,我想通过 api/experimental/route_name 调用它们
我有以下功能并希望将其与气流集成,以便每当我调用 api/experimental/api_userDetail 时都会显示详细信息。
我已将函数包含在文件 [endpoints.py] 中。由于某种原因,它没有出现在服务器中并显示 404 错误。如果我能找到一些方法,那就太好了。
def returnFromVariable(key_name):
return Variable.get(key_name,deserialize_json=True)
@api_experimental.route('/api_userDetail',methods=['GET'])
def userDetailApi():
get_element_config_name="user_credential"
return jsonify(returnFromVariable(get_element_config_name))```
The output is the data returned.
【问题讨论】:
-
如何注册您的包裹?如果你使用 Blueprint,你必须先注册你的包。或者展示你的结构。
-
我只是打开了文件并使用了实际由 Blueprint 处理的 api_experimental 装饰器。你能告诉我如何注册包吗?
-
应该在你的主文件中调用你的包并使用 register_blueprint 来注册你的包。我看不出你是如何构建你的应用的,所以我猜不出来。
-
感谢帮助其实我有气流的基本结构。我实际上在 site_package/airflow/www/api/experimental/endpoint.py 文件中添加了新功能。此文件在您下载气流时已提供。我希望这能解决一些问题。