30003报错 not a valid datetime or too skewed. Date: Tue, 17 Oct 2023 10:20:47 GMT

Viewed 96

import http.client

conn = http.client.HTTPSConnection("solution.wps.cn")

payload = "{"url":"https://xxx.com/xxx","filename":"文字文稿.docx"}"

headers = { 'Date': "Wed, 23 Jan 2013 06:43:08 GMT", 'Content-Md5': "d41d8cd98f00b204e9800998ecf8427e", 'Content-Type': "application/json",
'Authorization': "WPS-2:******:ac59dac1460772a04b3a97d7ef78409f28241e3a"
}

conn.request("POST", "/api/developer/v1/office/convert/to/pdf", payload, headers)

res = conn.getresponse() data = res.read()

print(data.decode("utf-8")) 调用这个报错'{"code":30003,"message":"InvalidSignature","hint":"not a valid datetime or too skewed. Date: Tue, 17 Oct 2023 10:20:47 GMT","extra":""}

2 Answers

Date与当前时间相差过大。使用当前时间就好了

使用当前时间也是报这样的错

使用当前也是报这样的错

参考这个回复:https://solution-community.wps.cn/questions/10010000000003634/10020000000003646,使用回复中的postman脚本,对比一下自己代码中的时间。 Date是格林尼治时间,看看是不是用的UTC+08时间