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

Class UpdateAPIThread

service/character.py:490–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488
489
490class UpdateAPIThread(threading.Thread):
491
492 def __init__(self, charID, callback):
493 threading.Thread.__init__(self)
494
495 self.name = "CheckUpdate"
496 self.callback = callback
497 self.charID = charID
498 self.running = True
499
500 def run(self):
501 try:
502 char = eos.db.getCharacter(self.charID)
503
504 sEsi = Esi.getInstance()
505 sChar = Character.getInstance()
506 ssoChar = sChar.getSsoCharacter(char.ID)
507
508 if not self.running:
509 self.callback[0](self.callback[1])
510 return
511 resp = sEsi.getSkills(ssoChar.ID)
512
513 if not self.running:
514 self.callback[0](self.callback[1])
515 return
516 # todo: check if alpha. if so, pop up a question if they want to apply it as alpha. Use threading events to set the answer?
517 char.clearSkills()
518 for skillRow in resp["skills"]:
519 char.addSkill(Skill(char, skillRow["skill_id"], skillRow["trained_skill_level"]))
520
521 if not self.running:
522 self.callback[0](self.callback[1])
523 return
524 resp = sEsi.getSecStatus(ssoChar.ID)
525 char.secStatus = resp['security_status']
526 self.callback[0](self.callback[1])
527 except (KeyboardInterrupt, SystemExit):
528 raise
529 except Exception as ex:
530 pyfalog.warn(ex)
531 self.callback[0](self.callback[1], sys.exc_info())
532
533 def stop(self):
534 self.running = False

Callers 1

apiFetchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected