MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / run

Method run

service/esi.py:35–60  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

33 self.running = True
34
35 def run(self):
36 with config.logging_setup.threadbound():
37 try:
38 esi = Esi.getInstance()
39 chars = esi.getSsoCharacters()
40
41 for char in chars:
42 if not self.running:
43 return
44
45 if char.is_token_expired():
46 pyfalog.info(f"Token expired for {char.characterName}, attempting refresh")
47 try:
48 esi.refresh(char)
49 eos.db.save(char)
50 pyfalog.info(f"Successfully refreshed token for {char.characterName}")
51 except Exception as e:
52 pyfalog.error(f"Failed to refresh token for {char.characterName}: {e}")
53 else:
54 pyfalog.debug(f"Token valid for {char.characterName}")
55
56 except Exception as e:
57 pyfalog.error(f"Error validating ESI tokens: {e}")
58 finally:
59 if self.callback:
60 wx.CallAfter(self.callback)
61
62 def stop(self):
63 self.running = False

Callers

nothing calls this directly

Calls 5

getSsoCharactersMethod · 0.80
is_token_expiredMethod · 0.80
saveMethod · 0.80
getInstanceMethod · 0.45
refreshMethod · 0.45

Tested by

no test coverage detected