def handle(signature:Union[str,int],echostr:Union[str,int],timestamp:Union[str,int],nonce:Union[str,int],):
try:
token = "75_yazfk2P_Iw-5WBhXEXW627RrbnltCowU9-VjtQiZ73gTlDyVcqfRfwopj1Vzfsc8XIVbI4RXtDiTwQrPiqnd5ysNNQ-4OI1vgXuK_B_MHmgKCQK0hO4WoqUHfcYJHXdADAOMC"
list = [token, timestamp, nonce]
list.sort()
temp = ''.join(list)
sha1 = hashlib.sha1(temp.encode('utf-8'))
hashcode = sha1.hexdigest()
if hashcode == signature:
return echostr
else:
return ""
except Exception as e:
return e
服务器记录:
INFO: 81.69.103.236:26750 - "GET /openapi/apici/token?signature=acd35d417e4bad0576306704532f85b87c76c344&echostr=2583273808176606973×tamp=1703407341&nonce=258197051 HTTP/1.0" 200 OK
h还是我本地使用同样的数据用python还有postman都可以验证,就是实际验证不通过。