|
|
@ -25,114 +25,127 @@ class ESI: |
|
|
|
# self.auth_esi = EsiAuth(config.client_id, config.secret_key) |
|
|
|
|
|
|
|
async def search(self, scope, entity): |
|
|
|
entity_search = self.esi.get_operation("get_search") |
|
|
|
result = await entity_search.execute( |
|
|
|
categories=scope, search=entity, strict="true" |
|
|
|
) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
entity_search = sesh.get_operation("get_search") |
|
|
|
result = await entity_search.execute( |
|
|
|
categories=scope, search=entity, strict="true" |
|
|
|
) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def loose_search(self, scope, entity): |
|
|
|
entity_search = self.esi.get_operation("get_search") |
|
|
|
result = await entity_search.execute( |
|
|
|
categories=scope, search=entity, strict="false" |
|
|
|
) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
entity_search = sesh.get_operation("get_search") |
|
|
|
result = await entity_search.execute( |
|
|
|
categories=scope, search=entity, strict="false" |
|
|
|
) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def kill_lookup(self, kill_id, kill_hash): |
|
|
|
kill_call = self.esi.get_operation("get_killmails_killmail_id_killmail_hash") |
|
|
|
result = await kill_call.execute(killmail_id=kill_id, killmail_hash=kill_hash) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
kill_call = sesh.get_operation("get_killmails_killmail_id_killmail_hash") |
|
|
|
result = await kill_call.execute( |
|
|
|
killmail_id=kill_id, killmail_hash=kill_hash |
|
|
|
) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def character_sheet(self, character_id): |
|
|
|
character_sheet_op = self.esi.get_operation("get_characters_character_id") |
|
|
|
result = await character_sheet_op.execute(character_id=character_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
character_sheet_op = sesh.get_operation("get_characters_character_id") |
|
|
|
result = await character_sheet_op.execute(character_id=character_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def corporation_history(self, character_id): |
|
|
|
corp_history_op = self.esi.get_operation( |
|
|
|
"get_characters_character_id_corporationhistory" |
|
|
|
) |
|
|
|
result = await corp_history_op.execute(character_id=character_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
corp_history_op = sesh.get_operation( |
|
|
|
"get_characters_character_id_corporationhistory" |
|
|
|
) |
|
|
|
result = await corp_history_op.execute(character_id=character_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def corporation_sheet(self, corporation_id): |
|
|
|
corporation_sheet_op = self.esi.get_operation("get_corporations_corporation_id") |
|
|
|
result = await corporation_sheet_op.execute(corporation_id=corporation_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
corporation_sheet_op = sesh.get_operation("get_corporations_corporation_id") |
|
|
|
result = await corporation_sheet_op.execute(corporation_id=corporation_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def alliance_sheet(self, alliance_id): |
|
|
|
alliance_sheet_op = self.esi.get_operation("get_alliances_alliance_id") |
|
|
|
result = await alliance_sheet_op.execute(alliance_id=alliance_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
alliance_sheet_op = sesh.get_operation("get_alliances_alliance_id") |
|
|
|
result = await alliance_sheet_op.execute(alliance_id=alliance_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def insurance_prices(self): |
|
|
|
insurance_op = self.esi.get_operation("get_insurance_prices") |
|
|
|
result = await insurance_op.execute() |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
insurance_op = sesh.get_operation("get_insurance_prices") |
|
|
|
result = await insurance_op.execute() |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def ship_info(self, ship_id): |
|
|
|
ship_op = self.esi.get_operation("get_universe_types_type_id") |
|
|
|
result = await ship_op.execute(type_id=ship_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
ship_op = sesh.get_operation("get_universe_types_type_id") |
|
|
|
result = await ship_op.execute(type_id=ship_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def system_info(self, system_id): |
|
|
|
system_op = self.esi.get_operation("get_universe_systems_system_id") |
|
|
|
result = await system_op.execute(system_id=system_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
system_op = sesh.get_operation("get_universe_systems_system_id") |
|
|
|
result = await system_op.execute(system_id=system_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def constellation_info(self, constellation_id): |
|
|
|
const_op = self.esi.get_operation( |
|
|
|
"get_universe_constellations_constellation_id" |
|
|
|
) |
|
|
|
result = await const_op.execute(constellation_id=constellation_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
const_op = sesh.get_operation( |
|
|
|
"get_universe_constellations_constellation_id" |
|
|
|
) |
|
|
|
result = await const_op.execute(constellation_id=constellation_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def region_info(self, region_id): |
|
|
|
region_op = self.esi.get_operation("get_universe_regions_region_id") |
|
|
|
result = await region_op.execute(region_id=region_id) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
region_op = sesh.get_operation("get_universe_regions_region_id") |
|
|
|
result = await region_op.execute(region_id=region_id) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def route(self, origin_id, destination_id, flag): |
|
|
|
route_op = self.esi.get_operation("get_route_origin_destination") |
|
|
|
try: |
|
|
|
result = await route_op.execute( |
|
|
|
origin=origin_id, destination=destination_id, flag=flag |
|
|
|
) |
|
|
|
except HTTPError: |
|
|
|
raise SwaggerError( |
|
|
|
"No Route Found, Did you try to navigate to a wormhole maybe?" |
|
|
|
) |
|
|
|
else: |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
route_op = sesh.get_operation("get_route_origin_destination") |
|
|
|
try: |
|
|
|
result = await route_op.execute( |
|
|
|
origin=origin_id, destination=destination_id, flag=flag |
|
|
|
) |
|
|
|
except HTTPError: |
|
|
|
raise SwaggerError( |
|
|
|
"No Route Found, Did you try to navigate to a wormhole maybe?" |
|
|
|
) |
|
|
|
else: |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def universe_names(self, ids): |
|
|
|
name_op = self.esi.get_operation("post_universe_names") |
|
|
|
result = await name_op.execute(ids=ids) |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
name_op = sesh.get_operation("post_universe_names") |
|
|
|
result = await name_op.execute(ids=ids) |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def system_kills(self): |
|
|
|
kills_op = self.esi.get_operation("get_universe_system_kills") |
|
|
|
result = await kills_op.execute() |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
kills_op = sesh.get_operation("get_universe_system_kills") |
|
|
|
result = await kills_op.execute() |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def system_jumps(self): |
|
|
|
jumps_op = self.esi.get_operation("get_universe_system_jumps") |
|
|
|
result = await jumps_op.execute() |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
jumps_op = sesh.get_operation("get_universe_system_jumps") |
|
|
|
result = await jumps_op.execute() |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def sov_map(self): |
|
|
|
sov_op = self.esi.get_operation("get_sovereignty_map") |
|
|
|
result = await sov_op.execute() |
|
|
|
return result.json() |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
sov_op = sesh.get_operation("get_sovereignty_map") |
|
|
|
result = await sov_op.execute() |
|
|
|
return result.json() |
|
|
|
|
|
|
|
async def system_adm(self): |
|
|
|
adm_op = self.esi.get_operation("get_sovereignty_structures") |
|
|
|
result = await adm_op.execute() |
|
|
|
return result.json() |
|
|
|
|
|
|
|
def raise_or_return(self, result): |
|
|
|
print(result) |
|
|
|
if result.status != 200: |
|
|
|
raise SwaggerError("ESI is down or broken currently :(") |
|
|
|
else: |
|
|
|
return result |
|
|
|
async with self.esi.session() as sesh: |
|
|
|
adm_op = sesh.get_operation("get_sovereignty_structures") |
|
|
|
result = await adm_op.execute() |
|
|
|
return result.json() |
|
|
|