优先优先排序
在每个电话之前 客户会挑最便宜的东西
| 状态状态状态状态状态状态状态状态 | 发生什么 |
|---|---|
| 缓存 JWT 尚未过期的 | 使用时的正数 - 没有网络 |
| 过期, 但缓存了刷新牌 | 更新,后使用 |
| 刷新失败, 否则没有缓存 | 键交换 |
| 没有密钥, 没有缓存会话 | 在此之前很久 建筑商拒绝 |
过期时间由象征本身读取, 而不是从时间计时器中猜到, 所以一天睡着的过程 和忙碌的过程一样。
缓存的
{ jwt, refreshToken, sessionId, storageId }# Stored in ~/.iagenify/session (or your session_path / storage)
{"jwt": ..., "refresh_token": ..., "session_id": ..., "storage_id": ...}storageId 机器如何在重新启动时保持相同身份:它被送回到下一个交换台,所以同一机器被识别,而不是登记两次。
await api.session();
// { id, storageId } — or null when nothing has been exchanged yetapi.session()
# {"id", "storageId"} — or None when nothing has been exchanged yet首次同时拨打
冷酷客户同时点火十通 交换一次 不是十通 重复由钥匙和钥匙 appName并且它在同一过程中将客户案例放在同一过程中——这就是使双重伤害变得无害的原因。
// One exchange, ten calls
await Promise.all([
api.getUser(),
api.catalogue(),
api.storage.list(),
api.keys.list(),
/* … */
]);# One exchange, ten calls: the first call exchanges the key, the others reuse it
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor() as pool:
user, prices, storages, keys = pool.map(lambda call: call(), [
api.get_user,
api.catalogue,
api.storage.list,
api.keys.list,
])结束会议
await api.auth.logout(); // this session
await api.auth.revokeSession(id); // another one, by idapi.auth.logout() # this session
api.auth.revoke_session(session_id) # another one, by id退出与取消密钥不同
会话结束; 键仍然有效, 下次调用时又交换它。 要完全停止键, 请取消键 。