diff --git a/services/managers/srp_manager.py b/services/managers/srp_manager.py index 007a044e..7f3aa049 100644 --- a/services/managers/srp_manager.py +++ b/services/managers/srp_manager.py @@ -34,20 +34,3 @@ class srpManager: return ship_type, ship_value else: raise ValueError("Invalid Kill ID") - - @staticmethod - def get_ship_name(ship_type): - url = ("https://jetbalsa.com/api/json.php/invTypes/%s" % ship_type) - headers = { - 'User-Agent': "%s Alliance Auth" % settings.DOMAIN, - 'Content-Type': 'application/json', - } - r = requests.get(url, headers=headers) - result = r.json() - if result: - ship_name = result['typeName'] - logger.debug("ship type %s determined to be %s" % (ship_type, ship_name)) - return ship_name - else: - logger.debug("ship type %s is invalid" % ship_type) - raise ValueError("Cannot get ship name") diff --git a/srp/views.py b/srp/views.py index 04bfb699..cd594753 100755 --- a/srp/views.py +++ b/srp/views.py @@ -15,6 +15,7 @@ from services.managers.srp_manager import srpManager from notifications import notify from django.utils import timezone from authentication.decorators import members_and_blues +from esi.clients import esi_client_factory import uuid import logging @@ -254,7 +255,8 @@ def srp_request_view(request, fleet_srp): messages.error(request, "Your SRP request Killmail link is invalid. Please make sure you are using zKillboard.") return redirect("auth_srp_management_view") - srp_ship_name = srpManager.get_ship_name(srp_kill_data) + c = esi_client_factory() + srp_ship_name = c.Universe.get_universe_types_type_id(type_id=srp_kill_data).result()['type_name'] srp_request.srp_ship_name = srp_ship_name kb_total_loss = ship_value srp_request.kb_total_loss = kb_total_loss