From 426e94bb8dadfecee793188bb1460e6ccc29b69e Mon Sep 17 00:00:00 2001 From: zhaomingqiang Date: Thu, 10 Feb 2022 15:11:43 +0800 Subject: [PATCH] bugfix: token expire time --- README.md | 2 +- README.zh.md | 2 +- src/larksuiteoapi/__init__.py | 2 +- src/larksuiteoapi/store.py | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5577ec64e..60733dabf 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ back to you as soon as possible. ```shell pip install typing # python version < 3.5 -pip install larksuite-oapi==1.0.32 +pip install larksuite-oapi==1.0.33 ``` ## Explanation of terms diff --git a/README.zh.md b/README.zh.md index ee5371664..210a809fd 100644 --- a/README.zh.md +++ b/README.zh.md @@ -28,7 +28,7 @@ ```shell pip install typing # python version < 3.5 -pip install larksuite-oapi==1.0.32 +pip install larksuite-oapi==1.0.33 ``` ## 术语解释 diff --git a/src/larksuiteoapi/__init__.py b/src/larksuiteoapi/__init__.py index 438751352..76392a4b9 100644 --- a/src/larksuiteoapi/__init__.py +++ b/src/larksuiteoapi/__init__.py @@ -7,4 +7,4 @@ from .logger import * from .store import * -VERSION = "1.0.32" +VERSION = "1.0.33" diff --git a/src/larksuiteoapi/store.py b/src/larksuiteoapi/store.py index 18190be72..3a2a83a3d 100644 --- a/src/larksuiteoapi/store.py +++ b/src/larksuiteoapi/store.py @@ -21,9 +21,9 @@ def set(self, key, value, expire): # type: (str, str, int) -> None class ExpireValue(object): - def __init__(self, value, expire): # type: (str, int) -> None + def __init__(self, value, expireTime): # type: (str, int) -> None self.value = value - self.expire = expire + self.expireTime = expireTime class MemoryStore(Store): @@ -43,7 +43,7 @@ def get(self, key): # type: (str) -> Tuple[bool, str] if val is None: return False, "" else: - if val.expire < int(time.time()): + if val.expireTime < int(time.time()): self.data.pop(key) return False, "" else: @@ -58,6 +58,6 @@ def set(self, key, value, expire): # type: (str, str, int) -> None """ self.mutex.acquire() try: - self.data[key] = ExpireValue(value, expire) + self.data[key] = ExpireValue(value, int(time.time()) + expire) finally: self.mutex.release()