mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-14 11:06:23 +01:00
Improve image tags to also work with eveonline objects, use new tags in group managenet, optimer, timerboard
This commit is contained in:
44
allianceauth/eveonline/evelinks/evewho.py
Normal file
44
allianceauth/eveonline/evelinks/evewho.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# this module generates profile URLs for evewho
|
||||
|
||||
from urllib.parse import urljoin, quote
|
||||
|
||||
from . import *
|
||||
|
||||
BASE_URL = 'https://evewho.com'
|
||||
|
||||
|
||||
def _build_url(category: str, eve_id: int) -> str:
|
||||
"""return url to profile page for an eve entity"""
|
||||
|
||||
if category == ESI_CATEGORY_ALLIANCE:
|
||||
partial = 'alliance'
|
||||
|
||||
elif category == ESI_CATEGORY_CORPORATION:
|
||||
partial = 'corporation'
|
||||
|
||||
elif category == ESI_CATEGORY_CHARACTER:
|
||||
partial = 'character'
|
||||
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Not implemented yet for category:" + category
|
||||
)
|
||||
|
||||
url = urljoin(
|
||||
BASE_URL,
|
||||
'{}/{}'.format(partial, int(eve_id))
|
||||
)
|
||||
return url
|
||||
|
||||
|
||||
def alliance_url(eve_id: int) -> str:
|
||||
"""url for page about given alliance on evewho"""
|
||||
return _build_url(ESI_CATEGORY_ALLIANCE, eve_id)
|
||||
|
||||
def character_url(eve_id: int) -> str:
|
||||
"""url for page about given character on evewho"""
|
||||
return _build_url(ESI_CATEGORY_CHARACTER, eve_id)
|
||||
|
||||
def corporation_url(eve_id: int) -> str:
|
||||
"""url for page about given corporation on evewho"""
|
||||
return _build_url(ESI_CATEGORY_CORPORATION, eve_id)
|
||||
Reference in New Issue
Block a user