phantasmobile/app/brake_backend.py

11 lines
267 B
Python
Raw Permalink Normal View History

2023-07-24 11:05:45 +00:00
from brake.backends import cachebe
class BrakeBackend(cachebe.CacheBackend):
def get_ip(self, request):
ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR"))
if ip:
ip = ip.split(", ")[-1]
return ip