【发布时间】:2022-01-04 05:06:07
【问题描述】:
我正在尝试使用 request.get_json() 将 JSON 数据中的节点添加到集合中。
@app.route('/connect_node', methods = ['POST'])
def connect_node():
json = request.get_json()
nodes = json.get('nodes')
if nodes is None:
return "No node", 400
The snapshot of the Postman POST request
我在 Spyder(Python 3.9) 中遇到的错误:
line 178, in connect_node
nodes = json.get(nodes)
AttributeError: 'tuple' object has no attribute 'get'
【问题讨论】:
标签: javascript python flask postman