Spaces:
Running
Running
jamelloverz-sketch commited on
Commit ·
6259d77
1
Parent(s): 2c8619d
fix: add 'global' keyword for _active_connections, _total_requests
Browse files
app.py
CHANGED
|
@@ -172,6 +172,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|
| 172 |
self.end_headers()
|
| 173 |
|
| 174 |
def do_GET(self):
|
|
|
|
| 175 |
if not self._check_rate_limit(self.client_address[0]):
|
| 176 |
self._json(429, {"error": "Too many requests"})
|
| 177 |
return
|
|
@@ -267,6 +268,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|
| 267 |
_active_connections -= 1
|
| 268 |
|
| 269 |
def do_POST(self):
|
|
|
|
| 270 |
if not self._check_rate_limit(self.client_address[0]):
|
| 271 |
self._json(429, {"error": "Too many requests"})
|
| 272 |
return
|
|
|
|
| 172 |
self.end_headers()
|
| 173 |
|
| 174 |
def do_GET(self):
|
| 175 |
+
global _active_connections, _total_requests
|
| 176 |
if not self._check_rate_limit(self.client_address[0]):
|
| 177 |
self._json(429, {"error": "Too many requests"})
|
| 178 |
return
|
|
|
|
| 268 |
_active_connections -= 1
|
| 269 |
|
| 270 |
def do_POST(self):
|
| 271 |
+
global _active_connections, _total_requests
|
| 272 |
if not self._check_rate_limit(self.client_address[0]):
|
| 273 |
self._json(429, {"error": "Too many requests"})
|
| 274 |
return
|