From d6ac52f08d31fa390b3501362ba02f46910dc1b6 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 16 May 2020 19:23:30 +0200 Subject: [PATCH] Fix regression with captcha --- pynyaata/config.py | 6 +++++- pynyaata/connectors/core.py | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pynyaata/config.py b/pynyaata/config.py index 33b1824..06a8607 100644 --- a/pynyaata/config.py +++ b/pynyaata/config.py @@ -14,10 +14,14 @@ ADMIN_PASSWORD = generate_password_hash(environ.get('ADMIN_PASSWORD', 'secret')) APP_PORT = environ.get('FLASK_PORT', 5000) CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60) REQUESTS_TIMEOUT = environ.get('REQUESTS_TIMEOUT', 5) -TWOCAPTCHA_API_KEY = environ.get('2CAPTCHA_API_KEY') BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else [] MYSQL_ENABLED = False +TWOCAPTCHA_API_KEY = { + 'provider': '2captcha', + 'api_key': environ.get('2CAPTCHA_API_KEY') +} if environ.get('2CAPTCHA_API_KEY') else None + app = Flask(__name__) app.name = 'PyNyaaTa' app.secret_key = urandom(24).hex() diff --git a/pynyaata/connectors/core.py b/pynyaata/connectors/core.py index 56bf6bb..a874a62 100644 --- a/pynyaata/connectors/core.py +++ b/pynyaata/connectors/core.py @@ -13,10 +13,7 @@ from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT, TWOCAPTCHA_API_K scraper = CloudScraperWrapper.create_scraper(browser={ 'custom': 'ScraperBot/1.0' -}, recaptcha={ - 'provider': '2captcha', - 'api_key': TWOCAPTCHA_API_KEY -}) +}, recaptcha=TWOCAPTCHA_API_KEY) class ConnectorReturn(Enum):