Fix Limiter: #49

This commit is contained in:
Piero Toffanin 2021-02-26 09:58:29 -05:00
parent 90de8e22a0
commit 3e952fbdb4
3 changed files with 12 additions and 1 deletions

View file

@ -83,6 +83,9 @@ def create_app(args):
key_func=get_remote_address, key_func=get_remote_address,
default_limits=get_routes_limits(args.req_limit, Database() if args.api_keys else None) default_limits=get_routes_limits(args.req_limit, Database() if args.api_keys else None)
) )
else:
from .no_limiter import Limiter
limiter = Limiter()
@app.errorhandler(400) @app.errorhandler(400)
def invalid_api(e): def invalid_api(e):

8
app/no_limiter.py Normal file
View file

@ -0,0 +1,8 @@
from functools import wraps
class Limiter:
def exempt(self, f):
@wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
return wrapper

View file

@ -3,7 +3,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup( setup(
version='1.2.0', version='1.2.1',
name='libretranslate', name='libretranslate',
license='GNU Affero General Public License v3.0', license='GNU Affero General Public License v3.0',
description='Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services.', description='Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services.',