问题描述
使用python实现 刷新access token的代码:
代码
def refresh_token(app_key, secret, access_token):
new_expiration_time = datetime.now() + relativedelta(months=+3)
expired_at = new_expiration_time.isoformat(timespec='milliseconds') + 'Z'
print("expired_at", expired_at)
headers = {
'X-Api-Key': app_key,
'Authorization': access_token,
'X-Timestamp': str(time.time()),
'Content-Type': 'application/json; charset=utf-8'
}
headers['X-Api-Signature'] = sign('GET', '/v1/token/refresh', headers, 'expired_at='+expired_at, "", secret)
response = requests.get(
'https://openapi.longportapp.com/v1/token/refresh',
params={
"expired_at": expired_at,
},
headers=headers
)
print(response)
print(response.text)
sign是复制的文档的函数,我不知道哪里没配置对,一直提示签名错误
错误信息或结果截图
{"code":403201,"message":"signature invalid","data":null}
你的环境信息
问题描述
使用python实现 刷新access token的代码:
代码
sign是复制的文档的函数,我不知道哪里没配置对,一直提示签名错误
错误信息或结果截图
{"code":403201,"message":"signature invalid","data":null}
你的环境信息