Speed testing Python example

This Python code sends 500 requests to the US endpoint for rotating sessions and prints out the lowest, highest, average response times a single request took, as well as number of successful requests out of 500.
You only need to change the username and password variables, and of course if you want to you can change the endpoint/port as well.

import time
import requests
url = 'https://ip.smartproxy.com/ip'
username = 'user'
password = 'pass'
proxy = f'http://{username}:{password}@us.smartproxy.com:10000'
average = 0
lowest = 50
highest = 0
success = 0
for i in range(500):
    start = time.time()
    response = requests.get(url, proxies={'http': proxy, 'https': proxy})
    end = time.time()
    total = (end - start)
    print(total)
    average += total
    if total < lowest: lowest = total
    if total > highest: highest = total
    if response.status_code == 200: success += 1
    else: print(response.status_code)
    if i == 499:
        print("average: " + str(average / 500))
        print("lowest: " + str(lowest))
        print("highest: " + str(highest))
        print("success: " + str(success))