23 lines
526 B
Python
23 lines
526 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
|
|
|
|
return event_dict
|
|
|
|
|
|
class HourUserRateThrottle(UserRateThrottle):
|
|
scope = "hour-throttle"
|
|
|
|
|
|
class DayUserRateThrottle(UserRateThrottle):
|
|
scope = "day-throttle"
|