-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
开场白的apikey 生成方式是什么,会不会过期? #7729
Labels
📚 documentation
Improvements or additions to documentation
Comments
开场白的 API key 生成方式是使用 以下是相关代码: API_TOKEN_TTL_SECONDS = 3 * 60
@cachetools.func.ttl_cache(maxsize=10, ttl=API_TOKEN_TTL_SECONDS - 30)
def generate_token(apikey: str):
try:
api_key, secret = apikey.split(".")
except Exception as e:
raise Exception("invalid api_key", e)
payload = {
"api_key": api_key,
"exp": int(round(time.time() * 1000)) + API_TOKEN_TTL_SECONDS * 1000,
"timestamp": int(round(time.time() * 1000)),
}
ret = jwt.encode(
payload,
secret,
algorithm="HS256",
headers={"alg": "HS256", "sign_type": "SIGN"},
)
return ret 生成的 token 会在 3 分钟后过期[1]. |
/api/parameters 里面的 authorization 会过期吗? |
I confirm that I am using English to submit report (我已阅读并同意 #1542). |
你好,提问之前请查看我们相关的语言政策,为了更好的交流请使用英语并且使用相应的模版进行提交,有疑问可以使用 Discussion,我注意到你这边已经多次违反我们的语言政策,如果后续还是不遵守我们相关政策,我们会进行相关封禁处理。 |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Self Checks
Provide a description of requested docs changes
开场白的apikey 生成方式是什么,会不会过期?
The text was updated successfully, but these errors were encountered: