Get ship type name from ESI

Closes #631
This commit is contained in:
Adarnof
2017-01-11 21:58:20 -05:00
parent 8360371ab7
commit e8915b84e5
2 changed files with 3 additions and 18 deletions

View File

@@ -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")