Update app.py
Browse files
app.py
CHANGED
|
@@ -125,6 +125,9 @@ init_models(device)
|
|
| 125 |
|
| 126 |
# Rate limit decorator - simple in-memory implementation
|
| 127 |
def rate_limit(f):
|
|
|
|
|
|
|
|
|
|
| 128 |
def decorated_function(*args, **kwargs):
|
| 129 |
client_ip = request.remote_addr or request.headers.get('X-Forwarded-For', 'unknown')
|
| 130 |
|
|
@@ -153,7 +156,6 @@ def rate_limit(f):
|
|
| 153 |
return f(*args, **kwargs)
|
| 154 |
|
| 155 |
return decorated_function
|
| 156 |
-
|
| 157 |
# Caching helpers
|
| 158 |
def compute_hash(data):
|
| 159 |
"""Compute a hash for caching purposes"""
|
|
|
|
| 125 |
|
| 126 |
# Rate limit decorator - simple in-memory implementation
|
| 127 |
def rate_limit(f):
|
| 128 |
+
from functools import wraps # Import wraps at the top of the decorator
|
| 129 |
+
|
| 130 |
+
@wraps(f) # Add this line to preserve function metadata
|
| 131 |
def decorated_function(*args, **kwargs):
|
| 132 |
client_ip = request.remote_addr or request.headers.get('X-Forwarded-For', 'unknown')
|
| 133 |
|
|
|
|
| 156 |
return f(*args, **kwargs)
|
| 157 |
|
| 158 |
return decorated_function
|
|
|
|
| 159 |
# Caching helpers
|
| 160 |
def compute_hash(data):
|
| 161 |
"""Compute a hash for caching purposes"""
|