diff --git a/CB/Core.py b/CB/Core.py index 854cd6e..43d1f31 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -513,6 +513,9 @@ def find_orphans(self): return orphanedaddon, orphaneconfig def search(self, query): + if self.config['WAAAPIKey'] == '': + raise RuntimeError('This feature requires the Wago Addons API key.\n' + 'It can be obtained here: https://addons.wago.io/patreon') results = [] payload = requests.get(f'https://addons.wago.io/api/external/addons/_search?query={quote_plus(query.strip())}' f'&game_version={self.clientType}', headers=HEADERS, @@ -546,6 +549,9 @@ def create_reg(self): '@="\\"' + os.path.abspath(sys.executable).replace('\\', '\\\\') + '\\" \\"%1\\""') def parse_wagoapp_payload(self, url): + if self.config['WAAAPIKey'] == '': + raise RuntimeError('This feature requires the Wago Addons API key.\n' + 'It can be obtained here: https://addons.wago.io/patreon') projectid = url.replace('wago-app://addons/', '') payload = requests.get(f'https://addons.wago.io/api/external/addons/{projectid}?game_version=' f'{self.clientType}', headers=HEADERS, @@ -618,6 +624,9 @@ def detect_accounts(self): # noinspection PyTypeChecker def detect_addons(self): + if self.config['WAAAPIKey'] == '': + raise RuntimeError('This feature requires the Wago Addons API key.\n' + 'It can be obtained here: https://addons.wago.io/patreon') names = [] namesinstalled = [] slugs = [] diff --git a/CB/WagoAddons.py b/CB/WagoAddons.py index f4f791e..2c7345e 100644 --- a/CB/WagoAddons.py +++ b/CB/WagoAddons.py @@ -20,6 +20,9 @@ def __init__(self, url, checkcache, clienttype, allowdev, apikey): self.payload['display_name'] = self.payload['name'] self.payload['recent_release'] = self.payload['recent_releases'] else: + if self.apiKey == '': + raise RuntimeError(f'{url}\nThe Wago Addons API key is missing. ' + f'It can be obtained here: https://addons.wago.io/patreon') try: self.payload = requests.get(f'https://addons.wago.io/api/external/addons/{project}?game_version=' f'{self.clientType}', headers=HEADERS, auth=APIAuth('Bearer', self.apiKey), diff --git a/CB/__init__.py b/CB/__init__.py index 32cbeb6..4db2879 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,7 +1,7 @@ import requests from rich.terminal_theme import TerminalTheme -__version__ = '4.2.0' +__version__ = '4.2.1' __license__ = 'GPLv3' __copyright__ = '2019-2022, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en'