Fix crash if Mega API key is not provided

Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
lzzy12 2020-06-19 15:33:00 +05:30
parent c6a430a44d
commit 45f75fb7a6
2 changed files with 3 additions and 2 deletions

View File

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

View File

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