credgrabber/stress.py

19 lines
344 B
Python

import random
import requests
import time
start = time.time()
count = 0
while True:
try:
r = requests.get("http://localhost:8000/hell/from/python/{}".format(
random.randint(0,2000)))
count += 1
except KeyboardInterrupt:
break
end = time.time()
print count, end - start
print count / (end - start)