Better Fix for flask limiter 4.0
This commit is contained in:
@@ -46,10 +46,11 @@ def main():
|
||||
try:
|
||||
from .kobo import kobo, get_kobo_activated
|
||||
from .kobo_auth import kobo_auth
|
||||
from flask_limiter.util import get_remote_address
|
||||
kobo_available = get_kobo_activated()
|
||||
except (ImportError, AttributeError): # Catch also error for not installed flask-WTF (missing csrf decorator)
|
||||
kobo_available = False
|
||||
kobo = kobo_auth = None
|
||||
kobo = kobo_auth = get_remote_address = None
|
||||
|
||||
try:
|
||||
from .oauth_bb import oauth
|
||||
@@ -76,6 +77,7 @@ def main():
|
||||
app.register_blueprint(gdrive)
|
||||
app.register_blueprint(editbook)
|
||||
if kobo_available:
|
||||
limiter.limit("3/minute", key_func=get_remote_address)(kobo)
|
||||
app.register_blueprint(kobo)
|
||||
app.register_blueprint(kobo_auth)
|
||||
if oauth_available:
|
||||
|
||||
Reference in New Issue
Block a user