Fix regression with captcha
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-05-16 19:23:30 +02:00
parent 5af34affa9
commit d6ac52f08d
2 changed files with 6 additions and 5 deletions

View File

@ -14,10 +14,14 @@ ADMIN_PASSWORD = generate_password_hash(environ.get('ADMIN_PASSWORD', 'secret'))
APP_PORT = environ.get('FLASK_PORT', 5000) APP_PORT = environ.get('FLASK_PORT', 5000)
CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60) CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60)
REQUESTS_TIMEOUT = environ.get('REQUESTS_TIMEOUT', 5) 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 [] BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else []
MYSQL_ENABLED = False 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 = Flask(__name__)
app.name = 'PyNyaaTa' app.name = 'PyNyaaTa'
app.secret_key = urandom(24).hex() app.secret_key = urandom(24).hex()

View File

@ -13,10 +13,7 @@ from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT, TWOCAPTCHA_API_K
scraper = CloudScraperWrapper.create_scraper(browser={ scraper = CloudScraperWrapper.create_scraper(browser={
'custom': 'ScraperBot/1.0' 'custom': 'ScraperBot/1.0'
}, recaptcha={ }, recaptcha=TWOCAPTCHA_API_KEY)
'provider': '2captcha',
'api_key': TWOCAPTCHA_API_KEY
})
class ConnectorReturn(Enum): class ConnectorReturn(Enum):