mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 16:03:57 +01:00
20 lines
445 B
Python
20 lines
445 B
Python
import os
|
|
import time
|
|
|
|
from dotenv import load_dotenv
|
|
from slowapi.util import get_remote_address
|
|
|
|
load_dotenv()
|
|
|
|
def get_ip(request) -> str:
|
|
"""Get the IP address of the incoming request."""
|
|
|
|
detected_ip = request.headers.get('cf-connecting-ip', get_remote_address(request))
|
|
return detected_ip
|
|
|
|
def get_ratelimit_key(request) -> str:
|
|
"""Get the IP address of the incoming request."""
|
|
|
|
ip = get_ip(request)
|
|
return ip
|