From df655a356c43617325b7d4121f60d92760d65648 Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Thu, 28 May 2020 21:02:04 +0530 Subject: [PATCH] Import mega api key from config.env file Signed-off-by: lzzy12 --- README.md | 1 + bot/__init__.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 8e39196..b402db9 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below: - **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes. - **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org - **USER_SESSION_STRING** : Session string generated by running: +- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk) ``` python3 generate_string_session.py ``` diff --git a/bot/__init__.py b/bot/__init__.py index 3097979..c08dee6 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -79,6 +79,12 @@ try: except KeyError as e: LOGGER.error("One or more env variables missing! Exiting now") exit(1) + +try: + MEGA_API_KEY = getConfig('MEGA_API_KEY') +except KeyError: + logging.warning('MEGA Api key not provided!') + MEGA_API_KEY = None try: INDEX_URL = getConfig('INDEX_URL') if len(INDEX_URL) == 0: