Python: how to solve "TypeError: 'str' object is not callable"

Python: how to solve "TypeError: 'str' object is not callable"

所以我有这个烧瓶 api 脚本

@app.route('/request', methods=["POST"])
def reqpost():
     content = request.get_json()
     h = content['type']
     if h == 'one'():
          typeone()
          return ("running type one")
     elif h == 'two'():
          typetwo()
          return ("running type two")
     else:
          return ("error!")

这是将在请求中发送的 json 数据

{
  "type": "typeone"
}

但是当我向服务器发送请求时,我在服务器输出中得到了这个

TypeError: 'str' object is not callable

这些行

if h == 'one'():
  # stuff
# and
elif h == 'two'():
  # stuff

我已经尝试在这些行中添加 str() 但我仍然遇到那个愚蠢的错误

任何帮助都会很好谢谢:)

ty 删除 ():

@app.route('/request', methods=["POST"])
def reqpost():
     content = request.get_json()
     h = content['type']
     if h == 'one':
          typeone()
          return ("running type one")
     elif h == 'two':
          typetwo()
          return ("running type two")
     else:
          return ("error!")