mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 07:51:00 +00:00
Fix Limiter: #49
This commit is contained in:
parent
90de8e22a0
commit
3e952fbdb4
3 changed files with 12 additions and 1 deletions
|
@ -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
8
app/no_limiter.py
Normal 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
|
2
setup.py
2
setup.py
|
@ -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.',
|
||||||
|
|
Loading…
Reference in a new issue