Python 龙卷风把插座挂了
我在龙卷风中做了休息服务。我尝试了一个带有JSON参数的GET,一切正常。但当我尝试在URL中使用参数时,我会收到一个带有postman的“套接字挂起”错误 这是发送的urlPython 龙卷风把插座挂了,python,python-3.x,rest,postman,tornado,Python,Python 3.x,Rest,Postman,Tornado,我在龙卷风中做了休息服务。我尝试了一个带有JSON参数的GET,一切正常。但当我尝试在URL中使用参数时,我会收到一个带有postman的“套接字挂起”错误 这是发送的url http://127.0.0.1:8080/scenarios/asyncexec?project_name=LBP22&scenario_name=6a27351e-e51f-4349-89d8-a3e326a5bd12 以及GET的处理程序 def get(self): # GET function
http://127.0.0.1:8080/scenarios/asyncexec?project_name=LBP22&scenario_name=6a27351e-e51f-4349-89d8-a3e326a5bd12
以及GET的处理程序
def get(self):
# GET function for checking the status of execution
project_name = self.get_argument('project_name')
scenario_name = self.get_argument('scenario_name')
Loggers.access.info("Polling for exec status")
running = False
save_exec_element = None
for exec_element in strategy_lab_config.Scenarios.Execute.exec_list:
if exec_element[1] == project_name and \
exec_element[2] == scenario_name:
exec_future = exec_element[0]
if exec_future.running():
self._generate_output_json_from_dict({"execution_status": "RET_OK_PROCESSING"})
running = True
break
elif exec_future.done():
save_exec_element = exec_element
try:
output = exec_future.result()
scenario = {
'project_name': project_name,
'scenario_name': scenario_name,
"execution_status": 'RET_OK_DONE',
"output": output
}
self._generate_output_json_from_dict(scenario)
break
except Exception as exec_exc:
scenario = {
'project_name': project_name,
'scenario_name': scenario_name,
"execution_status": 'RET_ERR_FAIL',
"error_message": str(exec_exc),
"traceback": "".join(traceback.TracebackException.from_exception(exec_exc).format())
}
self._generate_output_json_from_dict(scenario)
break
else:
self._generate_output_json_from_dict({"execution_status": "RET_ERR_NOT_EXIST"})
return
请注意,以前的版本使用JSON,一切正常
这里是处理器的定义
class Application(tornado.web.Application):
def __init__(self):
handlers = [
("/datasets/add", DatasetAdd),
("/projects/create", ProjectCreate),
("/projects/delete", ProjectDelete),
("/scenarios/execute", ScenarioExecute),
("/scenarios/asyncexec", AsyncScenarioExecute),
("/scenarios/tune", ScenarioTune),
("/scenarios/whatif", ScenarioWhatIfAnalysis)
]
tornado.web.Application.__init__(self, handlers, debug=True)
pass
RequestHandler
的prepare()
函数出现致命错误。因此服务器正确启动,但没有收到POST