I want it to send ~25 requests per second. Please help.
import requests
x = 1
for i in range(100):
requests.get("...")
print(x)
x += 1
I want it to send ~25 requests per second. Please help.
import requests
x = 1
for i in range(100):
requests.get("...")
print(x)
x += 1
You can use treads to run multiple requests at the same time. Look at this tutorial for more information about threading in python.
In your case, you can use something like this:
from threading import Thread
# target function
def foo():
for i in range(4):
requests.get("...")
# create 25 new threads
threadList = []
for t in range(25):
newThread = Thread(target=foo)
threadList.append(newThread)
# start all threads
for t in threadList:
t.start()
for t in threadList:
t.join()