试图通过python代码与google dialogflow通信会导致错误
我们已经编写了python代码来与google对话流进行通信。它在本地机器上运行良好,在其中一台构建机器上也运行良好。下面是我们编写的与dialogflow通信的代码试图通过python代码与google dialogflow通信会导致错误,python,dialogflow-es,Python,Dialogflow Es,我们已经编写了python代码来与google对话流进行通信。它在本地机器上运行良好,在其中一台构建机器上也运行良好。下面是我们编写的与dialogflow通信的代码 def diagflowInteraction(project_id, session_id, texts, language_code): """Returns the result of detect intent with texts as inputs. Using the s
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"}
我们在两小时内就要减产了。有人能帮我解决这个问题吗。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机器也更新为旧版本以解决问题,即使不确定问题是什么。您是否设法解决了此问题?我对从插件获取元数据失败的错误
503的理解是,它通常与凭证问题有关。凭据,我建议将它们添加到自身中,而不是作为环境变量,因为这是一种更好的做法。为此,您可以遵循Vision api的示例,并将其改编为Dialogflow api。此外,请查看机器之间的差异,例如不同版本的云sdk、Dialogflow客户端库,。。。如果两台机器在相同或不同的项目中,请共享。谢谢@aemon4。事实上,一些对话框流版本在生产机器上是不同的。忘了贴答案了。
cryptography 1.2.3
pycrypto 2.6.1