概念

会话

键被交换一次换为 JWT 并给您一个更新的标志。之后,键将留在您放放的地方,客户将自己续开会。

交换一次refreshed automatically
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

优先优先排序

在每个电话之前 客户会挑最便宜的东西

状态状态状态状态状态状态状态状态发生什么
缓存 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 yet
api.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 id
api.auth.logout()                    # this session
api.auth.revoke_session(session_id)  # another one, by id
退出与取消密钥不同

会话结束; 键仍然有效, 下次调用时又交换它。 要完全停止键, 请取消键 。