24 lines
609 B
Python
24 lines
609 B
Python
import logging
|
|
|
|
from django.conf import settings
|
|
from rest_framework.throttling import UserRateThrottle
|
|
from structlog.types import EventDict
|
|
|
|
|
|
def add_app_info(
|
|
logger: logging.Logger, method_name: str, event_dict: EventDict
|
|
) -> EventDict:
|
|
event_dict["django_app"] = "vbv_lernwelt"
|
|
event_dict["django_dev_mode"] = settings.DJANGO_DEV_MODE
|
|
event_dict["django_app_dev_mode"] = f"vbv_lernwelt_{settings.DJANGO_DEV_MODE}"
|
|
|
|
return event_dict
|
|
|
|
|
|
class HourUserRateThrottle(UserRateThrottle):
|
|
scope = "hour-throttle"
|
|
|
|
|
|
class DayUserRateThrottle(UserRateThrottle):
|
|
scope = "day-throttle"
|