问题描述
我是第一次尝试使用 Google Cloud Translate,但我无法解决“证书验证失败”错误。当我尝试运行以下代码时:
import os
from google.cloud import translate_v2 as translate
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = JSON FILE AUTOMATICALLY DOWNLOADED
translate_client = translate.Client()
text = "hello"
fr_lang = "en-US"
to_lang = "fr"
translated = translate_client.translate(text,target_language=to_lang,source_language=fr_lang)
print(text)
print(translated["translatedText"])
我收到一系列错误:
错误: [('SSL 例程','tls_process_server_certificate','证书验证失败')]
SSLError: ("错误的握手: Error([('SSL 例程','证书验证失败')],)",)
MaxRetryError: HTTPSConnectionPool(host='translation.googleapis.com',port=443): Max retries exceeded with url: /language/translate/v2?prettyPrint=false (Caused by SSLError(SSLError("bad handshake: Error) ([('SSL 例程',),))
SSLError: HTTPSConnectionPool(host='translation.googleapis.com',))
TransportError: HTTPSConnectionPool(host='oauth2.googleapis.com',port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLError("bad handshake: Error([('SSLroutines',))
我尝试查看有关发布的错误的类似问题,似乎解决方案是指定证书。如果问题出在其他地方,我该怎么做,或者如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)