尝试通过 python 代码与 google dialogflow 通信导致错误
Trying to communicate with google dialogflow through python code is resulting error
我们编写了 python 代码来与 google 对话流进行通信。它在我们的本地机器上运行良好,在其中一台构建机器上也运行良好。下面是我们编写的与dialogflow通信的代码。
def diagflowInteraction(project_id, session_id, texts, language_code):
"""Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversation."""
import dialogflow_v2 as dialogflow
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/data/DialogflowConfig.json'
session_client = dialogflow.SessionsClient()
session = session_client.session_path(project_id, session_id)
print('Session path: {}\n'.format(session))
text_input = dialogflow.types.TextInput(text=texts, language_code=language_code)
query_input = dialogflow.types.QueryInput(text=text_input)
print(query_input)
response = session_client.detect_intent(session=session, query_input=query_input)
但是我们用于生产的一台构建机器抛出以下错误。
google/api_core/timeout.py\", line 214, in func_with_timeout\n return func(*args, **kwargs)\n File \"/home/nodeappuser/.local/lib/python3.5/site-packages/google/api_core/grpc_helpers.py\", line 59, in error_remapped_callable\n six.raise_from(exceptions.from_grpc_error(exc), exc)\n File \"<string>\", line 2, in raise_from\ngoogle.api_core.exceptions.ServiceUnavailable: 503 Getting metadata from plugin failed with error: '_RSAPrivateKey' object has no attribute 'sign'\n","timestamp":"2020-11-16T20:02:16.123Z","type":"err","process_id":0,"app_name":"ChatBotInterface"}
不确定是什么原因导致该机器出现此问题。在互联网上找不到与该问题相关的太多内容。我们发现 相同类型的问题,表示旧密码库 (1.7.1) 是问题所在,建议升级到 2.6.1。但是我们所有的机器都有密码学最新版本 2.6.1,包括有问题的机器。
cryptography 1.2.3
pycrypto 2.6.1
我们的产量将在 2 小时内下降。谁能帮我解决这个问题。
PROD 机器(不工作)正在使用更高版本“google-auth==1.23.0”,grpcio==1.33.2,protobuf==3.14.0,pytz==2020.4
其他机器(正在运行)正在使用较低版本google-auth==1.22.1,grpcio==1.33.1,protobuf==3.13.0,pytz==2020.1
将 Prod 机器也更新到旧版本以修复问题,即使不确定问题是什么。
我们编写了 python 代码来与 google 对话流进行通信。它在我们的本地机器上运行良好,在其中一台构建机器上也运行良好。下面是我们编写的与dialogflow通信的代码。
def diagflowInteraction(project_id, session_id, texts, language_code):
"""Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversation."""
import dialogflow_v2 as dialogflow
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/data/DialogflowConfig.json'
session_client = dialogflow.SessionsClient()
session = session_client.session_path(project_id, session_id)
print('Session path: {}\n'.format(session))
text_input = dialogflow.types.TextInput(text=texts, language_code=language_code)
query_input = dialogflow.types.QueryInput(text=text_input)
print(query_input)
response = session_client.detect_intent(session=session, query_input=query_input)
但是我们用于生产的一台构建机器抛出以下错误。
google/api_core/timeout.py\", line 214, in func_with_timeout\n return func(*args, **kwargs)\n File \"/home/nodeappuser/.local/lib/python3.5/site-packages/google/api_core/grpc_helpers.py\", line 59, in error_remapped_callable\n six.raise_from(exceptions.from_grpc_error(exc), exc)\n File \"<string>\", line 2, in raise_from\ngoogle.api_core.exceptions.ServiceUnavailable: 503 Getting metadata from plugin failed with error: '_RSAPrivateKey' object has no attribute 'sign'\n","timestamp":"2020-11-16T20:02:16.123Z","type":"err","process_id":0,"app_name":"ChatBotInterface"}
不确定是什么原因导致该机器出现此问题。在互联网上找不到与该问题相关的太多内容。我们发现
cryptography 1.2.3
pycrypto 2.6.1
我们的产量将在 2 小时内下降。谁能帮我解决这个问题。
PROD 机器(不工作)正在使用更高版本“google-auth==1.23.0”,grpcio==1.33.2,protobuf==3.14.0,pytz==2020.4
其他机器(正在运行)正在使用较低版本google-auth==1.22.1,grpcio==1.33.1,protobuf==3.13.0,pytz==2020.1
将 Prod 机器也更新到旧版本以修复问题,即使不确定问题是什么。