Skip to content

Commit

Permalink
fix: fix issue for token expired
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroam committed Nov 19, 2024
1 parent 3a9875f commit 805b21b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kispy/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import pickle
import tempfile
from datetime import datetime
from datetime import datetime, timedelta

import pytz
import requests
Expand All @@ -24,7 +24,7 @@ def is_expired(self) -> bool:
kst = pytz.timezone("Asia/Seoul")
logger.debug(f"now: {datetime.now(kst)}")
logger.debug(f"expired: {self.access_token_token_expired}")
return datetime.now(kst) > self.access_token_token_expired
return datetime.now(kst) >= self.access_token_token_expired - timedelta(hours=1) # 1시간 전에 만료되면 갱신


class KisAuth:
Expand Down Expand Up @@ -66,7 +66,7 @@ def _get_token(self) -> Token:
resp.json["access_token_token_expired"],
"%Y-%m-%d %H:%M:%S",
)
).replace(tzinfo=kst)
)
return Token(
token_type=resp.json["token_type"],
access_token=resp.json["access_token"],
Expand Down

0 comments on commit 805b21b

Please sign in to comment.