创建批处理文件以在 Flask API(窗口)中执行 POST 方法



>我必须创建一个批处理文件,以便它调用以下API POST方法并在Windows上无缝执行。此处不需要向 POST 方法提供任何输入

这适用于由 API 调用的 ML 模块。我尝试通过批处理文件和 anaconda 提示符直接调用上述模块,但这不起作用。

import CLassName1
from flask import Flask
app=Flask(__name__)
@app.route('/api/model/testing', methods=['POST'])
def test_model():
     response=ClassName1.method_name1()
     return response
@app.route('/test')
def post_health():
     return "health"
if __name__ == '__main__':
     app.run(host='127.0.0.1',port=15010, debug=True)

预期运行method_name1和后续方法,然后填充在父文件夹中创建的另一个文件-"输出"。

实际上 - 当直接从 anaconda 提示符执行method_name1时,一段时间后会抛出导入错误并不断循环

您能否分享调用 method_name1(( 时获得的确切错误堆栈跟踪,因为只要 method_name1(( 返回字符串或 method_name1(( 中没有错误,此代码就应该运行。

最新更新