mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-08 20:10:17 +02:00
use new user-agent generator, drop specfile
This commit is contained in:
parent
daaffaeabc
commit
6452b082a8
@ -6,6 +6,6 @@ manage online service access.
|
||||
# Django starts so that shared_task will use this app.
|
||||
|
||||
__version__ = '5.0.0a1'
|
||||
__title__ = 'Alliance Auth'
|
||||
__title__ = 'AllianceAuth'
|
||||
__url__ = 'https://gitlab.com/allianceauth/allianceauth'
|
||||
NAME = f'{__title__} v{__version__}'
|
||||
|
@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from bravado.client import SwaggerClient
|
||||
from bravado.exception import HTTPError, HTTPNotFound, HTTPUnprocessableEntity
|
||||
from jsonschema.exceptions import RefResolutionError
|
||||
|
||||
@ -8,7 +9,7 @@ from django.conf import settings
|
||||
|
||||
from esi.clients import esi_client_factory
|
||||
|
||||
from allianceauth import __version__
|
||||
from allianceauth import __version__, __title__, __url__
|
||||
from allianceauth.utils.django import StartupCommand
|
||||
|
||||
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(
|
||||
@ -175,34 +176,19 @@ class EveProvider:
|
||||
|
||||
|
||||
class EveSwaggerProvider(EveProvider):
|
||||
def __init__(self, token=None, adapter=None):
|
||||
if settings.DEBUG or StartupCommand().is_management_command:
|
||||
self._client = None
|
||||
logger.info('ESI client will be loaded on-demand')
|
||||
else:
|
||||
logger.info('Loading ESI client')
|
||||
try:
|
||||
self._client = esi_client_factory(
|
||||
token=token,
|
||||
spec_file=SWAGGER_SPEC_PATH,
|
||||
app_info_text=f"allianceauth v{__version__}"
|
||||
)
|
||||
except (HTTPError, RefResolutionError):
|
||||
logger.exception(
|
||||
'Failed to load ESI client on startup. '
|
||||
'Switching to on-demand loading for ESI client.'
|
||||
)
|
||||
self._client = None
|
||||
|
||||
def __init__(self, token=None, adapter=None) -> None:
|
||||
self._token = token
|
||||
self.adapter = adapter or self
|
||||
self._faction_list = None # what are the odds this will change? could cache forever!
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
def client(self) -> SwaggerClient:
|
||||
if self._client is None:
|
||||
self._client = esi_client_factory(
|
||||
token=self._token, spec_file=SWAGGER_SPEC_PATH, app_info_text=("allianceauth v" + __version__)
|
||||
token=self._token,
|
||||
ua_appname=__title__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__,
|
||||
)
|
||||
return self._client
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@ import os
|
||||
|
||||
from esi.clients import EsiClientProvider
|
||||
|
||||
from allianceauth import __version__
|
||||
from allianceauth import __version__, __title__, __url__
|
||||
|
||||
SWAGGER_SPEC = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
||||
|
||||
@ -12,8 +12,8 @@ get_killmails_killmail_id_killmail_hash
|
||||
get_universe_types_type_id
|
||||
"""
|
||||
|
||||
|
||||
esi = EsiClientProvider(
|
||||
spec_file=SWAGGER_SPEC,
|
||||
app_info_text=("allianceauth v" + __version__)
|
||||
ua_appname=__title__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__,
|
||||
)
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user