python - TypeError: __init__() got an unexpected keyword argument iam_api_key
问题描述
I am getting the errors in Flask of "TypeError: init() got an unexpected keyword argument 'iam_api_key'". Actually, it was working fine with Python 2.7 and 3 before installing Flask. But, now it is not working with Python 3 after Flask installation. But, still working using Python 2.
from flask import Flask
from os.path import join, dirname
import json
app = Flask(__name__)
from watson_developer_cloud import SpeechToTextV1
@app.route('/',['GET'])
def hello_world():
url="https://gateway-wdc.watsonplatform.net/speech-to-text/api"
iam_api_key="IkhuCl3jbYWRJ3QV623PzX6e8715iCV6mbPA7evrD3qYHyS"
speech_to_text = SpeechToTextV1(url=url,iam_api_key=iam_api_key)
print (speech_to_text)
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug = True)
解决方案
该参数iam_api_key
已iam_apikey
在版本 1.7.1 中重命名为。在这个Github issue上有一些讨论。
推荐阅读
- ms-access - 需要在Access中使用SQL语句获取整数值
- reactjs - 使用 react-router-dom 更改路由功能
- python - 难以在 Tkinter 中显示用户输入的图像
- sparql - 查询事件的时间线 - DBpedia 和 SPARQL
- pandas - 如何找到两个不同大小的数据数组的元素之间的差异?
- java - java中的Mongo正则表达式查询
- amazon-web-services - 我可以使用哪些 aws 服务来部署 node.js 应用程序?
- linq - 在 Linq 中透视 - 想要在 linq 查询中将日期范围内的日期显示为列名
- api - 如何在 POST 请求中使用带有参数的 REST API 触发 Jenkins 管道的构建?
- azure - 如果具有 DeployIfNotExist 效果的 Azure Policy 的范围是资源组,它是否能够部署资源?