Q: How to hit each uri from list for multiple times parallely in python? I have list of URIs, each URIs from the list should hits multiple times with parallely. For example
uri_list = ["www.example1.com","www.example2.com", "www.example3.com"]
number_of_request = 10

The url www.example1.com should hit 10 times with parallel sessions. How to achieve this using python requests. Share your ideas. 
I tried like this but its not working.
import threading
import time
import requests

start_time = time.time()
urls = ["http://www.google.com", "http://www.apple.com", "http://www.microsoft.com", "http://www.amazon.com", "http://www.facebook.com"]
num_of_req = 10
def fetch_url(url):
    print url
    start = time.time()
    for i in range(num_of_req):
        resp = requests.get(url)
    print "'%s\' fetched in %ss" % (url, (time.time() - start))

threads = [threading.Thread(target=fetch_url, args=(url,)) for url in urls]
for thread in threads:
    thread.start()
for thread in threads:
    thread.join()

print "Elapsed Time: %s" % (time.time() - start_time)

Here all the uri's starts hitting parallel but number of requests for each uri is in sequentially.

A: You can simply remove the for i in range(num_of_req) from the fetch_url() function and multiply the urls array where you create the threads array:
threads = [threading.Thread(target=fetch_url, args=(url,)) for url in urls*num_of_req]

