在虚拟窗口上使用googlecloudvision api时出现无效的JWT错误

2024-09-28 15:36:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我在virtualbox上安装了windows7,以便在CentOS服务器的activeX网页上使用google cloud vision api。你知道吗

使用google cloud vision API进行身份验证,身份验证过程中出现以下错误:

google.api_core.exceptions.ServiceUnavailable: 503 Getting metadata from plugin failed with error: ('invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.')

Windows Internet时间同步,时间已同步,但发生错误。 但同样的代码在普通窗口上,不会发生错误。你知道吗

client = vision.ImageAnnotatorClient()

imgByteArr = io.BytesIO()
textImage.save(imgByteArr, format='PNG')
content = imgByteArr.getvalue()

image = types.Image(content=content)

response = client.text_detection(image=image)
labels = response.text_annotations
print(labels[0].description)

Tags: andimageclient身份验证apicloudresponse错误
1条回答
网友
1楼 · 发布于 2024-09-28 15:36:06

故障排除:重置主机操作系统时间(设置NTP)

问题是主机操作系统和客户操作系统之间的时间差。你知道吗

ln -sf / usr / share / zoneinfo / Asia / Seoul / etc / localtime
rdate -s time.bora.net
hwclock  systohc
date
hwclock

time.bora.net,找到并配置适当的ntp(网络时间协议)服务器。适合您的区域

相关问题 更多 >