Browse Source

Fix reusing ESI query builder.

master
Ben Kurtovic 7 years ago
parent
commit
2bc214cd4a
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      calefaction/eve/zkill.py

+ 5
- 5
calefaction/eve/zkill.py View File

@@ -27,32 +27,32 @@ class ZKillboard:
Requires ESI API calls to fill in entity names. If we can't do them, Requires ESI API calls to fill in entity names. If we can't do them,
we'll just set the names to be empty. we'll just set the names to be empty.
""" """
esi = g.eve.esi()
esi = g.eve.esi
victim = kill["victim"] victim = kill["victim"]


if "character_id" in victim: if "character_id" in victim:
char_info = esi.v4.characters(victim["character_id"]).get()
char_info = esi().v4.characters(victim["character_id"]).get()
victim["character_name"] = char_info["name"] victim["character_name"] = char_info["name"]
else: else:
victim["character_id"] = 0 victim["character_id"] = 0
victim["character_name"] = "" victim["character_name"] = ""


if "corporation_id" in victim: if "corporation_id" in victim:
corp_info = esi.v3.corporations(victim["corporation_id"]).get()
corp_info = esi().v3.corporations(victim["corporation_id"]).get()
victim["corporation_name"] = corp_info["corporation_name"] victim["corporation_name"] = corp_info["corporation_name"]
else: else:
victim["corporation_id"] = 0 victim["corporation_id"] = 0
victim["corporation_name"] = "" victim["corporation_name"] = ""


if "alliance_id" in victim: if "alliance_id" in victim:
alliance_info = esi.v2.alliances(victim["alliance_id"]).get()
alliance_info = esi().v2.alliances(victim["alliance_id"]).get()
victim["alliance_name"] = alliance_info["alliance_name"] victim["alliance_name"] = alliance_info["alliance_name"]
else: else:
victim["alliance_id"] = 0 victim["alliance_id"] = 0
victim["alliance_name"] = "" victim["alliance_name"] = ""


if "faction_id" in victim: if "faction_id" in victim:
factions = esi.v1.universe.factions.get()
factions = esi().v1.universe.factions.get()
matches = [fac["faction_name"] for fac in factions matches = [fac["faction_name"] for fac in factions
if fac["faction_id"] == victim["faction_id"]] if fac["faction_id"] == victim["faction_id"]]
victim["faction_name"] = matches[0] if matches else "" victim["faction_name"] = matches[0] if matches else ""


Loading…
Cancel
Save