Python请求Post在启动新的HTTP连接时卡住

2024-04-27 00:54:11 发布

您现在位置:Python中文网/ 问答频道 /正文

user_info = json.dumps({"bio":biography, "interests":interest_indexes})
headers = {'Content-type':'application/json'}
url = "http://0.0.0.0:5000/users/" + str(user_id)
r = requests.post("http://0.0.0.0:5000/users/1", data=user_info, headers=headers)

我已经启用了日志记录,这是在烧瓶中。如果我用正确的JSON响应体手动对URL执行POST请求,那么它可以正常工作。只是说信息:requests.packages.urllib3.connectionpool:正在启动新的HTTP连接(1):0.0.0.0

它永远挂在那里。在

有什么想法吗?在


Tags: infojsonhttptypecontentrequestsusersbio
1条回答
网友
1楼 · 发布于 2024-04-27 00:54:11

您需要在启用线程的情况下运行flask应用程序。在

app.run(threaded=True)

当然,这对于生产是不可取的,只是为了快速发展:)

相关问题 更多 >