API - init api rate limits w/ flask-limiter

This commit is contained in:
Sam
2022-09-17 19:36:03 +02:00
parent 47ec1c5a72
commit 4f88dcc8bc
8 changed files with 152 additions and 16 deletions

View File

@ -16,7 +16,7 @@ from sqlalchemy import exc
from werkzeug.exceptions import NotFound, RequestEntityTooLarge
from werkzeug.utils import secure_filename
from fittrackee import appLog, db
from fittrackee import appLog, db, limiter
from fittrackee.oauth2.server import require_auth
from fittrackee.responses import (
DataInvalidPayloadErrorResponse,
@ -784,6 +784,7 @@ def download_workout_gpx(
@workouts_blueprint.route('/workouts/map/<map_id>', methods=['GET'])
@limiter.exempt
def get_map(map_id: int) -> Union[HttpResponse, Response]:
"""
Get map image for workouts with gpx.
@ -830,6 +831,7 @@ def get_map(map_id: int) -> Union[HttpResponse, Response]:
@workouts_blueprint.route(
'/workouts/map_tile/<s>/<z>/<x>/<y>.png', methods=['GET']
)
@limiter.exempt
def get_map_tile(s: str, z: str, x: str, y: str) -> Tuple[Response, int]:
"""
Get map tile from tile server.