From 45f75fb7a6ddec95f91296129c34744174add5aa Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Fri, 19 Jun 2020 15:33:00 +0530 Subject: [PATCH] Fix crash if Mega API key is not provided Signed-off-by: lzzy12 --- bot/__init__.py | 2 +- bot/helper/mirror_utils/download_utils/mega_downloader.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 76fca77..a42a0ae 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -84,7 +84,7 @@ try: MEGA_API_KEY = getConfig('MEGA_API_KEY') except KeyError: logging.warning('MEGA API KEY not provided!') - + MEGA_API_KEY = None try: MEGA_EMAIL_ID = getConfig('MEGA_EMAIL_ID') MEGA_PASSWORD = getConfig('MEGA_PASSWORD') diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py index 1c8c987..081356a 100644 --- a/bot/helper/mirror_utils/download_utils/mega_downloader.py +++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py @@ -121,7 +121,8 @@ class MegaDownloadHelper: def __init__(self): pass - def add_download(self, mega_link: str, path: str, listener): + @staticmethod + def add_download(mega_link: str, path: str, listener): if MEGA_API_KEY is None: raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror mega links') executor = AsyncExecutor()