Make a callback for token refresh, not sure how I'm gonna handle this one yet
This commit is contained in:
@@ -25,6 +25,8 @@ pyfalog = Logger(__name__)
|
||||
|
||||
cache_path = os.path.join(config.savePath, config.ESI_CACHE)
|
||||
|
||||
from esipy.events import AFTER_TOKEN_REFRESH
|
||||
|
||||
if not os.path.exists(cache_path):
|
||||
os.mkdir(cache_path)
|
||||
|
||||
@@ -69,6 +71,8 @@ class Esi(object):
|
||||
def __init__(self):
|
||||
Esi.initEsiApp()
|
||||
|
||||
AFTER_TOKEN_REFRESH.add_receiver(self.tokenUpdate)
|
||||
|
||||
self.settings = CRESTSettings.getInstance()
|
||||
|
||||
# these will be set when needed
|
||||
@@ -86,6 +90,10 @@ class Esi(object):
|
||||
import gui.mainFrame # put this here to avoid loop
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def tokenUpdate(self, **kwargs):
|
||||
print(kwargs)
|
||||
pass
|
||||
|
||||
@property
|
||||
def isTestServer(self):
|
||||
return self.settings.get('server') == Servers.SISI
|
||||
@@ -105,7 +113,9 @@ class Esi(object):
|
||||
char = eos.db.getSsoCharacter(id, config.getClientSecret())
|
||||
if char is not None and char.esi_client is None:
|
||||
char.esi_client = Esi.genEsiClient()
|
||||
char.esi_client.security.update_token(Esi.get_sso_data(char))
|
||||
Esi.update_token(char, Esi.get_sso_data(char)) # don't use update_token on security directly, se still need to apply the values here
|
||||
print(repr(char))
|
||||
eos.db.commit()
|
||||
return char
|
||||
|
||||
def getSkills(self, id):
|
||||
|
||||
Reference in New Issue
Block a user