22 lines
556 B
Python
22 lines
556 B
Python
import requests
|
|
import threading
|
|
|
|
def send_request(user_id):
|
|
url = "http://localhost:8002"
|
|
data = {"input": f"Test input from user {user_id}"}
|
|
response = requests.post(url, json=data)
|
|
print(f"User {user_id} response: {response.text}")
|
|
|
|
def main(num_users):
|
|
threads = []
|
|
for i in range(num_users):
|
|
thread = threading.Thread(target=send_request, args=(i,))
|
|
threads.append(thread)
|
|
thread.start()
|
|
|
|
for thread in threads:
|
|
thread.join()
|
|
|
|
if __name__ == "__main__":
|
|
num_users = 2
|
|
main(num_users) |