-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89f5d71
commit 01fbdae
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import requests | ||
import concurrent.futures | ||
|
||
# URL y JSON de solicitud | ||
url = "https://whole-letisha-markalbrand56.koyeb.app/api/login" | ||
payload = { | ||
"usuario": "prueba@prueba", | ||
"contra": "prueba" | ||
} | ||
|
||
|
||
# Función para enviar una solicitud HTTP | ||
def send_request(url, payload): | ||
try: | ||
response = requests.post(url, json=payload) | ||
if response.status_code == 200: | ||
print("Solicitud exitosa") | ||
else: | ||
print(f"Fallo en la solicitud: {response.status_code}") | ||
except Exception as e: | ||
print(f"Error: {str(e)}") | ||
|
||
|
||
# Número de hilos concurrentes | ||
num_threads = 200 # Puedes ajustar este valor según tus necesidades | ||
|
||
# Crear un ThreadPoolExecutor para enviar solicitudes concurrentes | ||
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor: | ||
futures = [executor.submit(send_request, url, payload) for _ in range(num_threads)] | ||
|
||
# Esperar a que todas las solicitudes se completen | ||
concurrent.futures.wait(futures) |