def get(self, character_id): api = swagger_client.CharacterApi() try: return render_template('character.html', character=esi.get_character( api, character_id)) except ApiException as e: return api_fail(e)
def getName(charID): """""" characterApi = swagger_client.CharacterApi(_apiConfig) methodName = "get_characters_character_id" charName = _apiCall(characterApi, methodName, charID) return charName
def updatePortrait(self, user): api = swagger_client.CharacterApi() api = self.setApiDetails(api, user) try: response = api.get_characters_character_id_portrait(user.CharacterID) portrait = CharacterPortrait().setCharacterPortrait(response, user.get_id()) self.dbHandler.saveCharacterPortrait(portrait) except Exception as e: print("Exception in updateHandler.updatePortrait(): %s\n" % e)
def updateCharacter(self, user): api = swagger_client.CharacterApi() api = self.setApiDetails(api, user) try: response = api.get_characters_character_id(user.CharacterID) char = Character().setCharacter(response, user.get_id()) # create an databaseTables Object of Character self.dbHandler.saveCharacter(char) #self.updateAllianceName(char) #self.updateCorporationName(char) except Exception as e: print("Exception in updateHandler.updateCharacter(): %s\n" % e)
def get_affiliation(self, token, service_module): char_id = service_module.sso.get_char(token) if char_id: self.object_pilot = tb_characters(char_id) api = swagger_client.CharacterApi() api.api_client.set_default_header('User-Agent', "InsightDiscordKillfeeds") response = api.get_characters_character_id(character_id=char_id) if response.corporation_id: self.object_corp = tb_corporations(response.corporation_id) if response.alliance_id: self.object_alliance = tb_alliances(response.alliance_id) else: raise InsightExc.SSO.SSOerror
def updateCharacterNotifications(self, user): api = swagger_client.CharacterApi() api = self.setApiDetails(api, user) try: response = api.get_characters_character_id_notifications(user.CharacterID) notifications = [] for item in response: new = CharacterNotifications().create(item, user.id) notifications.append(new) self.dbHandler.saveCharacterNotification(new) except Exception as e: print("Exception in updateHandler.getCharacterNotifications: %s\n" % e)
def test_get_characters_character_id(self): api = swagger_client.CharacterApi() resp = api.get_characters_character_id(eulynn_id, user_agent=user_agent, async=False) self.assertEqual(resp.name, 'Eulynn')