Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from flask import Flask, request, Response, copy_current_request_context
|
2 |
import threading
|
3 |
import requests
|
4 |
import asyncio
|
@@ -29,7 +29,7 @@ def handle_request(path=""):
|
|
29 |
headers = {'Content-Type': 'application/json'}
|
30 |
if 'reply' in path:
|
31 |
if request_count.get(ip, 0) >= MAX_REQUESTS_PER_MINUTE:
|
32 |
-
return jsonify({"error": "Too Many Requests. Please try again later."}), 429
|
33 |
if ip in ongoing_requests:
|
34 |
return jsonify({"error": "Concurrent requests not allowed."}), 429
|
35 |
ongoing_requests[ip] = True
|
|
|
1 |
+
from flask import Flask, request, Response, copy_current_request_context, jsonify
|
2 |
import threading
|
3 |
import requests
|
4 |
import asyncio
|
|
|
29 |
headers = {'Content-Type': 'application/json'}
|
30 |
if 'reply' in path:
|
31 |
if request_count.get(ip, 0) >= MAX_REQUESTS_PER_MINUTE:
|
32 |
+
return jsonify({"error": "Too Many Requests. Please try again later."+ ip}), 429
|
33 |
if ip in ongoing_requests:
|
34 |
return jsonify({"error": "Concurrent requests not allowed."}), 429
|
35 |
ongoing_requests[ip] = True
|